@shipfox/api-integration-spi 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,2 @@
1
+ $ shipfox-swc
2
+ Successfully compiled: 3 files with swc (28.7ms)
@@ -0,0 +1 @@
1
+ $ shipfox-tsc-emit
@@ -0,0 +1 @@
1
+ $ shipfox-tsc-check
package/CHANGELOG.md ADDED
@@ -0,0 +1,21 @@
1
+ # @shipfox/api-integration-spi
2
+
3
+ ## 0.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 475ce59: Republishes all public packages after restoring release authorization.
8
+ - Updated dependencies [475ce59]
9
+ - @shipfox/api-integration-core-dto@9.0.1
10
+
11
+ ## 0.2.0
12
+
13
+ ### Minor Changes
14
+
15
+ - 4a6d124: Separates Integrations provider SPI contracts from the public DTO surface.
16
+
17
+ ### Patch Changes
18
+
19
+ - Updated dependencies [02974d6]
20
+ - Updated dependencies [4a6d124]
21
+ - @shipfox/api-integration-core-dto@9.0.0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Shipfox
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,175 @@
1
+ export type IntegrationProviderKind = string;
2
+ export type IntegrationCapability = 'source_control' | 'agent_tools';
3
+ export type IntegrationConnectionLifecycleStatus = 'active' | 'disabled' | 'error';
4
+ export interface IntegrationConnection<ProviderKind extends IntegrationProviderKind = IntegrationProviderKind> {
5
+ id: string;
6
+ workspaceId: string;
7
+ provider: ProviderKind;
8
+ externalAccountId: string;
9
+ slug: string;
10
+ displayName: string;
11
+ lifecycleStatus: IntegrationConnectionLifecycleStatus;
12
+ createdAt: Date;
13
+ updatedAt: Date;
14
+ }
15
+ export type RepositoryVisibility = 'public' | 'private' | 'internal' | 'unknown';
16
+ export interface RepositorySnapshot {
17
+ externalRepositoryId: string;
18
+ owner: string;
19
+ name: string;
20
+ fullName: string;
21
+ defaultBranch: string;
22
+ visibility: RepositoryVisibility;
23
+ cloneUrl: string;
24
+ htmlUrl: string;
25
+ }
26
+ export interface RepositoryPage {
27
+ repositories: RepositorySnapshot[];
28
+ nextCursor: string | null;
29
+ }
30
+ export interface ListRepositoriesInput<Connection extends IntegrationConnection = IntegrationConnection> {
31
+ connection: Connection;
32
+ limit: number;
33
+ cursor?: string | undefined;
34
+ search?: string | undefined;
35
+ }
36
+ export interface ResolveRepositoryInput<Connection extends IntegrationConnection = IntegrationConnection> {
37
+ connection: Connection;
38
+ externalRepositoryId: string;
39
+ }
40
+ export interface FileSnapshot {
41
+ path: string;
42
+ ref: string;
43
+ content: string;
44
+ }
45
+ export interface FileEntry {
46
+ path: string;
47
+ type: 'file';
48
+ size: number | null;
49
+ }
50
+ export interface FilePage {
51
+ files: FileEntry[];
52
+ nextCursor: string | null;
53
+ }
54
+ export interface ListFilesInput<Connection extends IntegrationConnection = IntegrationConnection> extends ResolveRepositoryInput<Connection> {
55
+ ref: string;
56
+ prefix: string;
57
+ limit: number;
58
+ cursor?: string | undefined;
59
+ }
60
+ export interface FetchFileInput<Connection extends IntegrationConnection = IntegrationConnection> extends ResolveRepositoryInput<Connection> {
61
+ ref: string;
62
+ path: string;
63
+ }
64
+ export interface CheckoutCredentials {
65
+ username: string;
66
+ token: string;
67
+ expiresAt: Date;
68
+ }
69
+ export interface CheckoutGitAuthor {
70
+ name: string;
71
+ email: string;
72
+ }
73
+ export interface CheckoutPermissions {
74
+ contents: 'read' | 'write';
75
+ }
76
+ export interface CheckoutSpec {
77
+ repositoryUrl: string;
78
+ ref: string;
79
+ credentials?: CheckoutCredentials | undefined;
80
+ gitAuthor?: CheckoutGitAuthor | undefined;
81
+ }
82
+ export interface CreateCheckoutSpecInput<Connection extends IntegrationConnection = IntegrationConnection> extends ResolveRepositoryInput<Connection> {
83
+ ref?: string | undefined;
84
+ permissions?: CheckoutPermissions | undefined;
85
+ }
86
+ export interface SourceControlProvider<Connection extends IntegrationConnection = IntegrationConnection> {
87
+ listRepositories(input: ListRepositoriesInput<Connection>): Promise<RepositoryPage>;
88
+ resolveRepository(input: ResolveRepositoryInput<Connection>): Promise<RepositorySnapshot>;
89
+ listFiles(input: ListFilesInput<Connection>): Promise<FilePage>;
90
+ fetchFile(input: FetchFileInput<Connection>): Promise<FileSnapshot>;
91
+ createCheckoutSpec?(input: CreateCheckoutSpecInput<Connection>): Promise<CheckoutSpec>;
92
+ }
93
+ export type AgentToolSensitivity = 'read' | 'write';
94
+ export type AgentToolJsonSchema = Record<string, unknown>;
95
+ export interface AgentToolCatalogMethod<RequiredScope = unknown> {
96
+ id: string;
97
+ description: string;
98
+ sensitivity: AgentToolSensitivity;
99
+ sensitive: boolean;
100
+ requiredScope: RequiredScope;
101
+ }
102
+ export interface AgentToolCatalogEntry<RequiredScope = unknown> {
103
+ id: string;
104
+ description: string;
105
+ sensitivity: AgentToolSensitivity;
106
+ sensitive: boolean;
107
+ requiredScope: RequiredScope;
108
+ inputSchema: AgentToolJsonSchema;
109
+ outputSchema?: AgentToolJsonSchema | undefined;
110
+ methods?: readonly AgentToolCatalogMethod<RequiredScope>[] | undefined;
111
+ }
112
+ export type AgentToolSelectorKind = 'family' | 'family_wildcard' | 'method' | 'standalone';
113
+ export interface AgentToolSelector {
114
+ readonly token: string;
115
+ readonly kind: AgentToolSelectorKind;
116
+ readonly sensitivity: AgentToolSensitivity;
117
+ readonly sensitive: boolean;
118
+ }
119
+ export interface AgentToolSelectionCatalog {
120
+ readonly selectors: readonly AgentToolSelector[];
121
+ }
122
+ export interface AgentToolCallInput {
123
+ toolId: string;
124
+ arguments: Record<string, unknown>;
125
+ }
126
+ export interface AgentToolSession<CallResult = unknown> {
127
+ call(input: AgentToolCallInput): Promise<CallResult>;
128
+ close?(): Promise<void>;
129
+ }
130
+ export interface OpenAgentToolsSessionInput<Connection extends IntegrationConnection = IntegrationConnection, RequiredScope = unknown, ProviderScope = unknown> {
131
+ connection: Connection;
132
+ tools: readonly AgentToolCatalogEntry<RequiredScope>[];
133
+ scope: ProviderScope;
134
+ }
135
+ export interface AgentToolsProvider<Connection extends IntegrationConnection = IntegrationConnection, RequiredScope = unknown, ProviderScope = unknown, CallResult = unknown> {
136
+ catalog(): readonly AgentToolCatalogEntry<RequiredScope>[] | Promise<readonly AgentToolCatalogEntry<RequiredScope>[]>;
137
+ selectionCatalog(): AgentToolSelectionCatalog | Promise<AgentToolSelectionCatalog>;
138
+ openSession(input: OpenAgentToolsSessionInput<Connection, RequiredScope, ProviderScope>): Promise<AgentToolSession<CallResult>>;
139
+ }
140
+ export interface IntegrationProviderAdapters<Connection extends IntegrationConnection = IntegrationConnection> {
141
+ source_control?: SourceControlProvider<Connection> | undefined;
142
+ agent_tools?: AgentToolsProvider<Connection> | undefined;
143
+ }
144
+ /** Processes one provider-neutral inbound webhook request. */
145
+ export interface WebhookRequestProcessor {
146
+ process(request: import('@shipfox/api-integration-core-dto').StoredWebhookRequest): Promise<import('@shipfox/api-integration-core-dto').WebhookProcessingResult>;
147
+ }
148
+ export interface IntegrationProvider<ProviderKind extends IntegrationProviderKind = IntegrationProviderKind, Route = unknown, Connection extends IntegrationConnection<ProviderKind> = IntegrationConnection<ProviderKind>> {
149
+ provider: ProviderKind;
150
+ displayName: string;
151
+ adapters?: IntegrationProviderAdapters<Connection> | undefined;
152
+ routes?: Route[] | undefined;
153
+ connectionExternalUrl?(connection: Connection): Promise<string | undefined>;
154
+ deleteConnectionRecords?(connection: Connection, options: {
155
+ tx: unknown;
156
+ }): Promise<void>;
157
+ deleteConnectionSecrets?(connection: Connection): Promise<void>;
158
+ }
159
+ export interface RegisteredIntegrationProvider<ProviderKind extends IntegrationProviderKind = IntegrationProviderKind, Route = unknown, Connection extends IntegrationConnection<ProviderKind> = IntegrationConnection<ProviderKind>> extends IntegrationProvider<ProviderKind, Route, Connection> {
160
+ adapters: IntegrationProviderAdapters<Connection>;
161
+ capabilities: IntegrationCapability[];
162
+ }
163
+ export type IntegrationProviderErrorReason = 'repository-not-found' | 'installation-not-found' | 'file-not-found' | 'access-denied' | 'rate-limited' | 'timeout' | 'provider-unavailable' | 'malformed-provider-response' | 'content-too-large' | 'too-many-files';
164
+ export declare class IntegrationProviderError extends Error {
165
+ readonly reason: IntegrationProviderErrorReason;
166
+ readonly retryAfterSeconds?: number | undefined;
167
+ constructor(reason: IntegrationProviderErrorReason, message: string, retryAfterSeconds?: number | undefined);
168
+ }
169
+ export declare class ConnectionSlugConflictError extends Error {
170
+ constructor(cause: unknown);
171
+ }
172
+ export declare const MAX_REPOSITORY_FILE_BYTES = 1000000;
173
+ export declare function buildProviderRepositoryId(provider: IntegrationProviderKind, value: string): string;
174
+ export declare function parseProviderRepositoryId(externalRepositoryId: string, expectedProvider: IntegrationProviderKind): string;
175
+ //# sourceMappingURL=contracts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":"AAAA,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,CACvC,QAAQ,EAAE,uBAAuB,EACjC,KAAK,EAAE,MAAM,GACZ,MAAM,CAER;AAED,wBAAgB,yBAAyB,CACvC,oBAAoB,EAAE,MAAM,EAC5B,gBAAgB,EAAE,uBAAuB,GACxC,MAAM,CAuBR"}
@@ -0,0 +1,35 @@
1
+ export class IntegrationProviderError extends Error {
2
+ constructor(reason, message, retryAfterSeconds){
3
+ super(message), this.reason = reason, this.retryAfterSeconds = retryAfterSeconds;
4
+ this.name = 'IntegrationProviderError';
5
+ }
6
+ }
7
+ export class ConnectionSlugConflictError extends Error {
8
+ constructor(cause){
9
+ super('Could not allocate a unique integration connection slug. Try again.', {
10
+ cause
11
+ });
12
+ this.name = 'ConnectionSlugConflictError';
13
+ }
14
+ }
15
+ export const MAX_REPOSITORY_FILE_BYTES = 1_000_000;
16
+ export function buildProviderRepositoryId(provider, value) {
17
+ return `${provider}:${value}`;
18
+ }
19
+ export function parseProviderRepositoryId(externalRepositoryId, expectedProvider) {
20
+ const separatorIndex = externalRepositoryId.indexOf(':');
21
+ if (separatorIndex <= 0) {
22
+ throw new IntegrationProviderError('repository-not-found', `External repository id is missing a provider prefix: ${externalRepositoryId}`);
23
+ }
24
+ const prefix = externalRepositoryId.slice(0, separatorIndex);
25
+ const value = externalRepositoryId.slice(separatorIndex + 1);
26
+ if (prefix !== expectedProvider) {
27
+ throw new IntegrationProviderError('repository-not-found', `External repository id ${externalRepositoryId} is not owned by provider ${expectedProvider}`);
28
+ }
29
+ if (!value) {
30
+ throw new IntegrationProviderError('repository-not-found', `External repository id ${externalRepositoryId} is missing a provider-owned value`);
31
+ }
32
+ return value;
33
+ }
34
+
35
+ //# sourceMappingURL=contracts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/contracts.ts"],"sourcesContent":["export type IntegrationProviderKind = string;\nexport type IntegrationCapability = 'source_control' | 'agent_tools';\nexport type IntegrationConnectionLifecycleStatus = 'active' | 'disabled' | 'error';\n\nexport interface IntegrationConnection<\n ProviderKind extends IntegrationProviderKind = IntegrationProviderKind,\n> {\n id: string;\n workspaceId: string;\n provider: ProviderKind;\n externalAccountId: string;\n slug: string;\n displayName: string;\n lifecycleStatus: IntegrationConnectionLifecycleStatus;\n createdAt: Date;\n updatedAt: Date;\n}\n\nexport type RepositoryVisibility = 'public' | 'private' | 'internal' | 'unknown';\n\nexport interface RepositorySnapshot {\n externalRepositoryId: string;\n owner: string;\n name: string;\n fullName: string;\n defaultBranch: string;\n visibility: RepositoryVisibility;\n cloneUrl: string;\n htmlUrl: string;\n}\n\nexport interface RepositoryPage {\n repositories: RepositorySnapshot[];\n nextCursor: string | null;\n}\n\nexport interface ListRepositoriesInput<\n Connection extends IntegrationConnection = IntegrationConnection,\n> {\n connection: Connection;\n limit: number;\n cursor?: string | undefined;\n search?: string | undefined;\n}\n\nexport interface ResolveRepositoryInput<\n Connection extends IntegrationConnection = IntegrationConnection,\n> {\n connection: Connection;\n externalRepositoryId: string;\n}\n\nexport interface FileSnapshot {\n path: string;\n ref: string;\n content: string;\n}\n\nexport interface FileEntry {\n path: string;\n type: 'file';\n size: number | null;\n}\n\nexport interface FilePage {\n files: FileEntry[];\n nextCursor: string | null;\n}\n\nexport interface ListFilesInput<Connection extends IntegrationConnection = IntegrationConnection>\n extends ResolveRepositoryInput<Connection> {\n ref: string;\n prefix: string;\n limit: number;\n cursor?: string | undefined;\n}\n\nexport interface FetchFileInput<Connection extends IntegrationConnection = IntegrationConnection>\n extends ResolveRepositoryInput<Connection> {\n ref: string;\n path: string;\n}\n\nexport interface CheckoutCredentials {\n username: string;\n token: string;\n expiresAt: Date;\n}\n\nexport interface CheckoutGitAuthor {\n name: string;\n email: string;\n}\n\nexport interface CheckoutPermissions {\n contents: 'read' | 'write';\n}\n\nexport interface CheckoutSpec {\n repositoryUrl: string;\n ref: string;\n credentials?: CheckoutCredentials | undefined;\n gitAuthor?: CheckoutGitAuthor | undefined;\n}\n\nexport interface CreateCheckoutSpecInput<\n Connection extends IntegrationConnection = IntegrationConnection,\n> extends ResolveRepositoryInput<Connection> {\n ref?: string | undefined;\n permissions?: CheckoutPermissions | undefined;\n}\n\nexport interface SourceControlProvider<\n Connection extends IntegrationConnection = IntegrationConnection,\n> {\n listRepositories(input: ListRepositoriesInput<Connection>): Promise<RepositoryPage>;\n resolveRepository(input: ResolveRepositoryInput<Connection>): Promise<RepositorySnapshot>;\n listFiles(input: ListFilesInput<Connection>): Promise<FilePage>;\n fetchFile(input: FetchFileInput<Connection>): Promise<FileSnapshot>;\n createCheckoutSpec?(input: CreateCheckoutSpecInput<Connection>): Promise<CheckoutSpec>;\n}\n\nexport type AgentToolSensitivity = 'read' | 'write';\nexport type AgentToolJsonSchema = Record<string, unknown>;\n\nexport interface AgentToolCatalogMethod<RequiredScope = unknown> {\n id: string;\n description: string;\n sensitivity: AgentToolSensitivity;\n sensitive: boolean;\n requiredScope: RequiredScope;\n}\n\nexport interface AgentToolCatalogEntry<RequiredScope = unknown> {\n id: string;\n description: string;\n sensitivity: AgentToolSensitivity;\n sensitive: boolean;\n requiredScope: RequiredScope;\n inputSchema: AgentToolJsonSchema;\n outputSchema?: AgentToolJsonSchema | undefined;\n methods?: readonly AgentToolCatalogMethod<RequiredScope>[] | undefined;\n}\n\nexport type AgentToolSelectorKind = 'family' | 'family_wildcard' | 'method' | 'standalone';\n\nexport interface AgentToolSelector {\n readonly token: string;\n readonly kind: AgentToolSelectorKind;\n readonly sensitivity: AgentToolSensitivity;\n readonly sensitive: boolean;\n}\n\nexport interface AgentToolSelectionCatalog {\n readonly selectors: readonly AgentToolSelector[];\n}\n\nexport interface AgentToolCallInput {\n toolId: string;\n arguments: Record<string, unknown>;\n}\n\nexport interface AgentToolSession<CallResult = unknown> {\n call(input: AgentToolCallInput): Promise<CallResult>;\n close?(): Promise<void>;\n}\n\nexport interface OpenAgentToolsSessionInput<\n Connection extends IntegrationConnection = IntegrationConnection,\n RequiredScope = unknown,\n ProviderScope = unknown,\n> {\n connection: Connection;\n tools: readonly AgentToolCatalogEntry<RequiredScope>[];\n scope: ProviderScope;\n}\n\nexport interface AgentToolsProvider<\n Connection extends IntegrationConnection = IntegrationConnection,\n RequiredScope = unknown,\n ProviderScope = unknown,\n CallResult = unknown,\n> {\n catalog():\n | readonly AgentToolCatalogEntry<RequiredScope>[]\n | Promise<readonly AgentToolCatalogEntry<RequiredScope>[]>;\n selectionCatalog(): AgentToolSelectionCatalog | Promise<AgentToolSelectionCatalog>;\n openSession(\n input: OpenAgentToolsSessionInput<Connection, RequiredScope, ProviderScope>,\n ): Promise<AgentToolSession<CallResult>>;\n}\n\nexport interface IntegrationProviderAdapters<\n Connection extends IntegrationConnection = IntegrationConnection,\n> {\n source_control?: SourceControlProvider<Connection> | undefined;\n agent_tools?: AgentToolsProvider<Connection> | undefined;\n}\n\n/** Processes one provider-neutral inbound webhook request. */\nexport interface WebhookRequestProcessor {\n process(\n request: import('@shipfox/api-integration-core-dto').StoredWebhookRequest,\n ): Promise<import('@shipfox/api-integration-core-dto').WebhookProcessingResult>;\n}\n\nexport interface IntegrationProvider<\n ProviderKind extends IntegrationProviderKind = IntegrationProviderKind,\n Route = unknown,\n Connection extends IntegrationConnection<ProviderKind> = IntegrationConnection<ProviderKind>,\n> {\n provider: ProviderKind;\n displayName: string;\n adapters?: IntegrationProviderAdapters<Connection> | undefined;\n routes?: Route[] | undefined;\n connectionExternalUrl?(connection: Connection): Promise<string | undefined>;\n deleteConnectionRecords?(connection: Connection, options: {tx: unknown}): Promise<void>;\n deleteConnectionSecrets?(connection: Connection): Promise<void>;\n}\n\nexport interface RegisteredIntegrationProvider<\n ProviderKind extends IntegrationProviderKind = IntegrationProviderKind,\n Route = unknown,\n Connection extends IntegrationConnection<ProviderKind> = IntegrationConnection<ProviderKind>,\n> extends IntegrationProvider<ProviderKind, Route, Connection> {\n adapters: IntegrationProviderAdapters<Connection>;\n capabilities: IntegrationCapability[];\n}\n\nexport type IntegrationProviderErrorReason =\n | 'repository-not-found'\n | 'installation-not-found'\n | 'file-not-found'\n | 'access-denied'\n | 'rate-limited'\n | 'timeout'\n | 'provider-unavailable'\n | 'malformed-provider-response'\n | 'content-too-large'\n | 'too-many-files';\n\nexport class IntegrationProviderError extends Error {\n constructor(\n public readonly reason: IntegrationProviderErrorReason,\n message: string,\n public readonly retryAfterSeconds?: number | undefined,\n ) {\n super(message);\n this.name = 'IntegrationProviderError';\n }\n}\n\nexport class ConnectionSlugConflictError extends Error {\n constructor(cause: unknown) {\n super('Could not allocate a unique integration connection slug. Try again.', {cause});\n this.name = 'ConnectionSlugConflictError';\n }\n}\n\nexport const MAX_REPOSITORY_FILE_BYTES = 1_000_000;\n\nexport function buildProviderRepositoryId(\n provider: IntegrationProviderKind,\n value: string,\n): string {\n return `${provider}:${value}`;\n}\n\nexport function parseProviderRepositoryId(\n externalRepositoryId: string,\n expectedProvider: IntegrationProviderKind,\n): string {\n const separatorIndex = externalRepositoryId.indexOf(':');\n if (separatorIndex <= 0) {\n throw new IntegrationProviderError(\n 'repository-not-found',\n `External repository id is missing a provider prefix: ${externalRepositoryId}`,\n );\n }\n const prefix = externalRepositoryId.slice(0, separatorIndex);\n const value = externalRepositoryId.slice(separatorIndex + 1);\n if (prefix !== expectedProvider) {\n throw new IntegrationProviderError(\n 'repository-not-found',\n `External repository id ${externalRepositoryId} is not owned by provider ${expectedProvider}`,\n );\n }\n if (!value) {\n throw new IntegrationProviderError(\n 'repository-not-found',\n `External repository id ${externalRepositoryId} is missing a provider-owned value`,\n );\n }\n return value;\n}\n"],"names":["IntegrationProviderError","Error","reason","message","retryAfterSeconds","name","ConnectionSlugConflictError","cause","MAX_REPOSITORY_FILE_BYTES","buildProviderRepositoryId","provider","value","parseProviderRepositoryId","externalRepositoryId","expectedProvider","separatorIndex","indexOf","prefix","slice"],"mappings":"AAiPA,OAAO,MAAMA,iCAAiCC;IAC5C,YACE,AAAgBC,MAAsC,EACtDC,OAAe,EACf,AAAgBC,iBAAsC,CACtD;QACA,KAAK,CAACD,eAJUD,SAAAA,aAEAE,oBAAAA;QAGhB,IAAI,CAACC,IAAI,GAAG;IACd;AACF;AAEA,OAAO,MAAMC,oCAAoCL;IAC/C,YAAYM,KAAc,CAAE;QAC1B,KAAK,CAAC,uEAAuE;YAACA;QAAK;QACnF,IAAI,CAACF,IAAI,GAAG;IACd;AACF;AAEA,OAAO,MAAMG,4BAA4B,UAAU;AAEnD,OAAO,SAASC,0BACdC,QAAiC,EACjCC,KAAa;IAEb,OAAO,GAAGD,SAAS,CAAC,EAAEC,OAAO;AAC/B;AAEA,OAAO,SAASC,0BACdC,oBAA4B,EAC5BC,gBAAyC;IAEzC,MAAMC,iBAAiBF,qBAAqBG,OAAO,CAAC;IACpD,IAAID,kBAAkB,GAAG;QACvB,MAAM,IAAIf,yBACR,wBACA,CAAC,qDAAqD,EAAEa,sBAAsB;IAElF;IACA,MAAMI,SAASJ,qBAAqBK,KAAK,CAAC,GAAGH;IAC7C,MAAMJ,QAAQE,qBAAqBK,KAAK,CAACH,iBAAiB;IAC1D,IAAIE,WAAWH,kBAAkB;QAC/B,MAAM,IAAId,yBACR,wBACA,CAAC,uBAAuB,EAAEa,qBAAqB,0BAA0B,EAAEC,kBAAkB;IAEjG;IACA,IAAI,CAACH,OAAO;QACV,MAAM,IAAIX,yBACR,wBACA,CAAC,uBAAuB,EAAEa,qBAAqB,kCAAkC,CAAC;IAEtF;IACA,OAAOF;AACT"}
@@ -0,0 +1,4 @@
1
+ export * from '@shipfox/api-integration-core-dto';
2
+ export * from '#contracts.js';
3
+ export * from '#ports.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC;AAClD,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,5 @@
1
+ export * from '@shipfox/api-integration-core-dto';
2
+ export * from '#contracts.js';
3
+ export * from '#ports.js';
4
+
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from '@shipfox/api-integration-core-dto';\nexport * from '#contracts.js';\nexport * from '#ports.js';\n"],"names":[],"mappings":"AAAA,cAAc,oCAAoC;AAClD,cAAc,gBAAgB;AAC9B,cAAc,YAAY"}
@@ -0,0 +1,60 @@
1
+ import type { IntegrationEventReceivedEvent, SourcePushPayload } from '@shipfox/api-integration-core-dto';
2
+ import type { IntegrationConnection, IntegrationConnectionLifecycleStatus } from '#contracts.js';
3
+ export type IntegrationTx = any;
4
+ export type PublishIntegrationEventReceivedFn = (params: {
5
+ tx: IntegrationTx;
6
+ event: IntegrationEventReceivedEvent;
7
+ }) => Promise<{
8
+ published: boolean;
9
+ }>;
10
+ export type CreateIntegrationConnectionFn = (params: {
11
+ workspaceId: string;
12
+ provider: string;
13
+ externalAccountId: string;
14
+ slug: string;
15
+ displayName: string;
16
+ lifecycleStatus?: IntegrationConnectionLifecycleStatus | undefined;
17
+ }, options?: {
18
+ tx?: IntegrationTx;
19
+ }) => Promise<IntegrationConnection>;
20
+ export type PublishSourcePushFn = (params: {
21
+ tx: IntegrationTx;
22
+ provider: string;
23
+ source: string;
24
+ workspaceId: string;
25
+ connectionId: string;
26
+ connectionName: string;
27
+ deliveryId: string;
28
+ receivedAt: string;
29
+ rawPayload: unknown;
30
+ push: SourcePushPayload;
31
+ }) => Promise<{
32
+ published: boolean;
33
+ }>;
34
+ export type RecordDeliveryOnlyFn = (params: {
35
+ tx: IntegrationTx;
36
+ provider: string;
37
+ deliveryId: string;
38
+ }) => Promise<void>;
39
+ export type ClaimWebhookDeliveryFn = (params: {
40
+ tx: IntegrationTx;
41
+ provider: string;
42
+ deliveryId: string;
43
+ }) => Promise<{
44
+ claimed: boolean;
45
+ }>;
46
+ export type GetIntegrationConnectionByIdFn = (id: string, options?: {
47
+ tx?: IntegrationTx;
48
+ }) => Promise<IntegrationConnection | undefined>;
49
+ export type UpdateIntegrationConnectionLifecycleStatusFn = (params: {
50
+ id: string;
51
+ lifecycleStatus: IntegrationConnectionLifecycleStatus;
52
+ }, options?: {
53
+ tx?: IntegrationTx;
54
+ }) => Promise<IntegrationConnection | undefined>;
55
+ export type DeleteIntegrationConnectionFn = (params: {
56
+ id: string;
57
+ }, options?: {
58
+ tx?: IntegrationTx;
59
+ }) => Promise<boolean>;
60
+ //# sourceMappingURL=ports.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ports.d.ts","sourceRoot":"","sources":["../src/ports.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,6BAA6B,EAC7B,iBAAiB,EAClB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EAAC,qBAAqB,EAAE,oCAAoC,EAAC,MAAM,eAAe,CAAC;AAG/F,MAAM,MAAM,aAAa,GAAG,GAAG,CAAC;AAEhC,MAAM,MAAM,iCAAiC,GAAG,CAAC,MAAM,EAAE;IACvD,EAAE,EAAE,aAAa,CAAC;IAClB,KAAK,EAAE,6BAA6B,CAAC;CACtC,KAAK,OAAO,CAAC;IAAC,SAAS,EAAE,OAAO,CAAA;CAAC,CAAC,CAAC;AAEpC,MAAM,MAAM,6BAA6B,GAAG,CAC1C,MAAM,EAAE;IACN,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,oCAAoC,GAAG,SAAS,CAAC;CACpE,EACD,OAAO,CAAC,EAAE;IAAC,EAAE,CAAC,EAAE,aAAa,CAAA;CAAC,KAC3B,OAAO,CAAC,qBAAqB,CAAC,CAAC;AAEpC,MAAM,MAAM,mBAAmB,GAAG,CAAC,MAAM,EAAE;IACzC,EAAE,EAAE,aAAa,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,MA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AE;IAAC,EAAE,CAAC,EAAE,aAAa,CAAA;CAAC,KAC3B,OAAO,CAAC,OAAO,CAAC,CAAC"}
package/dist/ports.js ADDED
@@ -0,0 +1,3 @@
1
+ export { };
2
+
3
+ //# sourceMappingURL=ports.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/ports.ts"],"sourcesContent":["import type {\n IntegrationEventReceivedEvent,\n SourcePushPayload,\n} from '@shipfox/api-integration-core-dto';\nimport type {IntegrationConnection, IntegrationConnectionLifecycleStatus} from '#contracts.js';\n\n// biome-ignore lint/suspicious/noExplicitAny: cross-package transaction handles stay opaque to provider packages\nexport type IntegrationTx = any;\n\nexport type PublishIntegrationEventReceivedFn = (params: {\n tx: IntegrationTx;\n event: IntegrationEventReceivedEvent;\n}) => Promise<{published: boolean}>;\n\nexport type CreateIntegrationConnectionFn = (\n params: {\n workspaceId: string;\n provider: string;\n externalAccountId: string;\n slug: string;\n displayName: string;\n lifecycleStatus?: IntegrationConnectionLifecycleStatus | undefined;\n },\n options?: {tx?: IntegrationTx},\n) => Promise<IntegrationConnection>;\n\nexport type PublishSourcePushFn = (params: {\n tx: IntegrationTx;\n provider: string;\n source: string;\n workspaceId: string;\n connectionId: string;\n connectionName: string;\n deliveryId: string;\n receivedAt: string;\n rawPayload: unknown;\n push: SourcePushPayload;\n}) => Promise<{published: boolean}>;\n\nexport type RecordDeliveryOnlyFn = (params: {\n tx: IntegrationTx;\n provider: string;\n deliveryId: string;\n}) => Promise<void>;\n\nexport type ClaimWebhookDeliveryFn = (params: {\n tx: IntegrationTx;\n provider: string;\n deliveryId: string;\n}) => Promise<{claimed: boolean}>;\n\nexport type GetIntegrationConnectionByIdFn = (\n id: string,\n options?: {tx?: IntegrationTx},\n) => Promise<IntegrationConnection | undefined>;\n\nexport type UpdateIntegrationConnectionLifecycleStatusFn = (\n params: {id: string; lifecycleStatus: IntegrationConnectionLifecycleStatus},\n options?: {tx?: IntegrationTx},\n) => Promise<IntegrationConnection | undefined>;\n\nexport type DeleteIntegrationConnectionFn = (\n params: {id: string},\n options?: {tx?: IntegrationTx},\n) => Promise<boolean>;\n"],"names":[],"mappings":"AA6DA,WAGsB"}