@fourier-labs/harbour-contracts 0.44.0 → 0.45.0
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.
- package/README.md +4 -0
- package/contract-release.json +26 -8
- package/dist/gen-ts/app-integrations-declaration.d.ts +48 -0
- package/dist/gen-ts/app-integrations-declaration.js +3 -0
- package/dist/gen-ts/contract-release.d.ts +6 -6
- package/dist/gen-ts/contract-release.js +6 -6
- package/dist/gen-ts/data-grant-v2.d.ts +84 -0
- package/dist/gen-ts/data-grant-v2.js +13 -0
- package/dist/gen-ts/index.d.ts +9 -0
- package/dist/gen-ts/index.js +9 -0
- package/dist/gen-ts/integration-connect-result.d.ts +14 -0
- package/dist/gen-ts/integration-connect-result.js +3 -0
- package/dist/gen-ts/integration-error-details.d.ts +22 -0
- package/dist/gen-ts/integration-error-details.js +3 -0
- package/dist/gen-ts/integration-execute-request.d.ts +30 -0
- package/dist/gen-ts/integration-execute-request.js +3 -0
- package/dist/gen-ts/integration-execute-result.d.ts +23 -0
- package/dist/gen-ts/integration-execute-result.js +3 -0
- package/dist/gen-ts/kit-bundle-manifest.d.ts +32 -0
- package/dist/gen-ts/kit-bundle-manifest.js +3 -0
- package/dist/gen-ts/kit-lock.d.ts +46 -0
- package/dist/gen-ts/kit-lock.js +3 -0
- package/dist/gen-ts/saas-connection.d.ts +73 -0
- package/dist/gen-ts/saas-connection.js +3 -0
- package/gen-ts/app-integrations-declaration.ts +52 -0
- package/gen-ts/contract-release.ts +6 -6
- package/gen-ts/data-grant-v2.ts +98 -0
- package/gen-ts/index.ts +9 -0
- package/gen-ts/integration-connect-result.ts +21 -0
- package/gen-ts/integration-error-details.ts +47 -0
- package/gen-ts/integration-execute-request.ts +33 -0
- package/gen-ts/integration-execute-result.ts +27 -0
- package/gen-ts/kit-bundle-manifest.ts +36 -0
- package/gen-ts/kit-lock.ts +48 -0
- package/gen-ts/saas-connection.ts +77 -0
- package/package.json +1 -1
- package/schema/app-integrations-declaration.schema.json +144 -0
- package/schema/data-grant-v2.schema.json +108 -0
- package/schema/integration-connect-result.schema.json +24 -0
- package/schema/integration-error-details.schema.json +64 -0
- package/schema/integration-execute-request.schema.json +73 -0
- package/schema/integration-execute-result.schema.json +48 -0
- package/schema/kit-bundle-manifest.schema.json +66 -0
- package/schema/kit-lock.schema.json +37 -0
- package/schema/saas-connection.schema.json +115 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// Code generated by tools/gen/gen.mjs from schema/*.json. DO NOT EDIT.
|
|
3
|
+
|
|
4
|
+
export type IntegrationConnectionKind = 'saas' | 'database';
|
|
5
|
+
/**
|
|
6
|
+
* Tenant-wide logical alias of a connection (governance sourceId) or of a resource under it.
|
|
7
|
+
*/
|
|
8
|
+
export type IntegrationAlias = string;
|
|
9
|
+
/**
|
|
10
|
+
* @minItems 1
|
|
11
|
+
* @maxItems 64
|
|
12
|
+
*/
|
|
13
|
+
export type ResourceNames = IntegrationAlias[];
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Committed `.harbour/integrations.json`: the app's declared use of tenant-wide integration connections. Keys are logical connection aliases (the governance sourceId); resources are logical names (Slack channel alias, warehouse view name), never IDs, tokens or URLs. The operation set is closed (three operations) and each operation carries a fixed identity mode: slack.channel.history=user, slack.message.post=app, warehouse.view.read=app. A `saas` connection may declare only the Slack operations and a `database` connection only warehouse.view.read. This file also owns the shared IntegrationOperation / IntegrationIdentityMode / IntegrationEnvironment / IntegrationConnectionKind enums referenced by the other integration schemas.
|
|
17
|
+
*/
|
|
18
|
+
export interface AppIntegrationsDeclaration {
|
|
19
|
+
schema: 'harbour.app-integrations/2.0';
|
|
20
|
+
connections: {
|
|
21
|
+
[k: string]: DeclaredConnection;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export interface DeclaredConnection {
|
|
25
|
+
kind: IntegrationConnectionKind;
|
|
26
|
+
operations: {
|
|
27
|
+
'slack.channel.history'?: UserModeChannelOperation;
|
|
28
|
+
'slack.message.post'?: AppModeChannelOperation;
|
|
29
|
+
'warehouse.view.read'?: AppModeViewOperation;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export interface UserModeChannelOperation {
|
|
33
|
+
identity: 'user';
|
|
34
|
+
resources: ResourceNames;
|
|
35
|
+
}
|
|
36
|
+
export interface AppModeChannelOperation {
|
|
37
|
+
identity: 'app';
|
|
38
|
+
resources: ResourceNames;
|
|
39
|
+
}
|
|
40
|
+
export interface AppModeViewOperation {
|
|
41
|
+
identity: 'app';
|
|
42
|
+
resources: {
|
|
43
|
+
[k: string]: ViewResource;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
export interface ViewResource {
|
|
47
|
+
/**
|
|
48
|
+
* @minItems 1
|
|
49
|
+
* @maxItems 32
|
|
50
|
+
*/
|
|
51
|
+
columns: string[];
|
|
52
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
2
|
// Code generated by tools/gen/gen.mjs from schema/*.json. DO NOT EDIT.
|
|
3
3
|
|
|
4
|
-
export const ContractRepositoryVersion = "0.
|
|
5
|
-
export const ContractPublishVersion = "0.
|
|
6
|
-
export const ContractPublishTag = "v0.
|
|
7
|
-
export const ContractSchemasDigest = "sha256:
|
|
4
|
+
export const ContractRepositoryVersion = "0.45.0.0" as const;
|
|
5
|
+
export const ContractPublishVersion = "0.45.0" as const;
|
|
6
|
+
export const ContractPublishTag = "v0.45.0" as const;
|
|
7
|
+
export const ContractSchemasDigest = "sha256:4cef9cebaaa623a613cb8c748558a9ac5d3622aeca31138f17c983cd8cfb6eb3" as const;
|
|
8
8
|
export const ContractAiFixturesDigest = "sha256:edac31c92e146ca1c40130f2fb5649db82e24b8cd1ac758153b90612052fddb6" as const;
|
|
9
|
-
export const ContractGeneratedGoDigest = "sha256:
|
|
10
|
-
export const ContractGeneratedTypeScriptDigest = "sha256:
|
|
9
|
+
export const ContractGeneratedGoDigest = "sha256:4134b582754e02f9248bcb579a4ec335da3ab1d87d92b3720d9ac8ee3cb1eec1" as const;
|
|
10
|
+
export const ContractGeneratedTypeScriptDigest = "sha256:a57c25fdfbb06518e95bade4dd57441d39a2bb3f11fbbd8d78df5e8773d0ca9b" as const;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// Code generated by tools/gen/gen.mjs from schema/*.json. DO NOT EDIT.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Grant lifecycle state. Legal edges live in x-transitions; DENIED and REVOKED are terminal.
|
|
6
|
+
*/
|
|
7
|
+
export type DataGrantV2Status = 'REQUESTED' | 'GRANTED' | 'DENIED' | 'REVOKED';
|
|
8
|
+
/**
|
|
9
|
+
* Provider-side work for the current approved scope (credential mint, cleanup, installation check).
|
|
10
|
+
*/
|
|
11
|
+
export type DataGrantV2ProvisioningStatus = 'NONE' | 'PENDING' | 'FAILED' | 'DONE';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* An app's integration grant for one connection, environment and identity mode (control table sk APP#<appId>#IGRANT#<environment>#<sourceId>#<mode>; grantId = base64url(JSON ["v2",appId,environment,sourceId,mode])). Additive to the legacy DataGrant (data-grant.schema.json), which is never consulted by v2 paths. Expiry is enforced from UTC time on every call and SDK calls never extend it. Status edges live in x-transitions; DENIED and REVOKED are terminal (a regrant after revocation is a new REQUESTED record once cleanup is DONE). Database grants add credentialRef/mintedPrincipal, SaaS grants add installation; both hold references only.
|
|
15
|
+
*/
|
|
16
|
+
export interface DataGrantV2 {
|
|
17
|
+
schema: 'harbour.data-grant/2.0';
|
|
18
|
+
appId: string;
|
|
19
|
+
/**
|
|
20
|
+
* Tenant-wide logical alias of a connection (governance sourceId) or of a resource under it.
|
|
21
|
+
*/
|
|
22
|
+
sourceId: string;
|
|
23
|
+
kind: 'saas' | 'database';
|
|
24
|
+
/**
|
|
25
|
+
* development is the CLI/local kit; preview and production are hosted.
|
|
26
|
+
*/
|
|
27
|
+
environment: 'development' | 'preview' | 'production';
|
|
28
|
+
/**
|
|
29
|
+
* Whose authority an operation runs under. Fixed per operation; callers never choose it.
|
|
30
|
+
*/
|
|
31
|
+
identityMode: 'app' | 'user';
|
|
32
|
+
status: DataGrantV2Status;
|
|
33
|
+
/**
|
|
34
|
+
* Approved operations; each must match this grant's identityMode.
|
|
35
|
+
*
|
|
36
|
+
* @minItems 1
|
|
37
|
+
* @maxItems 3
|
|
38
|
+
*/
|
|
39
|
+
operations: ('slack.channel.history' | 'slack.message.post' | 'warehouse.view.read')[];
|
|
40
|
+
/**
|
|
41
|
+
* Approved logical resource names (channel aliases or view names). Never inherited by wildcard.
|
|
42
|
+
*
|
|
43
|
+
* @minItems 1
|
|
44
|
+
* @maxItems 64
|
|
45
|
+
*/
|
|
46
|
+
resources: string[];
|
|
47
|
+
/**
|
|
48
|
+
* Absent only for explicitly approved ongoing production access.
|
|
49
|
+
*/
|
|
50
|
+
expiresAt?: string;
|
|
51
|
+
approvedBy?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Optimistic-concurrency version; approvals compare it with the reviewed value.
|
|
54
|
+
*/
|
|
55
|
+
version: number;
|
|
56
|
+
/**
|
|
57
|
+
* The one open access request attached to this grant, if any.
|
|
58
|
+
*/
|
|
59
|
+
pendingRequestId?: string;
|
|
60
|
+
provisioning: DataGrantV2Provisioning;
|
|
61
|
+
/**
|
|
62
|
+
* Database grants: secretref://tenant/{t}/app/{a}/env/{env}/source/{s}.
|
|
63
|
+
*/
|
|
64
|
+
credentialRef?: string;
|
|
65
|
+
/**
|
|
66
|
+
* Database grants: the deterministic per tenant/app/environment/source principal.
|
|
67
|
+
*/
|
|
68
|
+
mintedPrincipal?: string;
|
|
69
|
+
/**
|
|
70
|
+
* SaaS grants: the connection installation this environment maps to.
|
|
71
|
+
*/
|
|
72
|
+
installation?: string;
|
|
73
|
+
}
|
|
74
|
+
export interface DataGrantV2Provisioning {
|
|
75
|
+
status: DataGrantV2ProvisioningStatus;
|
|
76
|
+
/**
|
|
77
|
+
* Failed attempts; three requires an admin retry.
|
|
78
|
+
*/
|
|
79
|
+
attempts: number;
|
|
80
|
+
/**
|
|
81
|
+
* Sanitized reason; never a provider error body.
|
|
82
|
+
*/
|
|
83
|
+
lastError?: string;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const legalDataGrantV2StatusTransitions: Record<string, Record<string, true>> = {
|
|
87
|
+
"REQUESTED": { "GRANTED": true, "DENIED": true },
|
|
88
|
+
"GRANTED": { "REVOKED": true },
|
|
89
|
+
};
|
|
90
|
+
const terminalDataGrantV2StatusStates = new Set<string>(["DENIED", "REVOKED"]);
|
|
91
|
+
|
|
92
|
+
/** True iff from→to is a legal DataGrantV2Status edge (schema x-transitions). */
|
|
93
|
+
export function canTransitionDataGrantV2Status(from: string, to: string): boolean {
|
|
94
|
+
return Boolean(legalDataGrantV2StatusTransitions[from]?.[to]);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/** True iff the DataGrantV2Status is terminal (DENIED, REVOKED). */
|
|
98
|
+
export function isTerminalDataGrantV2Status(state: string): boolean { return terminalDataGrantV2StatusStates.has(state); }
|
package/gen-ts/index.ts
CHANGED
|
@@ -22,12 +22,14 @@ export * from './ai-transform-event.js';
|
|
|
22
22
|
export * from './ai-transform-result.js';
|
|
23
23
|
export * from './ai-verification-evidence.js';
|
|
24
24
|
export * from './api-error-response.js';
|
|
25
|
+
export * from './app-integrations-declaration.js';
|
|
25
26
|
export * from './artifact-contract.js';
|
|
26
27
|
export * from './binding-classification-digest-helper.js';
|
|
27
28
|
export * from './binding-classification-subject.js';
|
|
28
29
|
export * from './builder-input-proposal.js';
|
|
29
30
|
export * from './contract-release.js';
|
|
30
31
|
export * from './data-dependency.js';
|
|
32
|
+
export * from './data-grant-v2.js';
|
|
31
33
|
export * from './data-grant.js';
|
|
32
34
|
export * from './data-source.js';
|
|
33
35
|
export * from './deploy-request.js';
|
|
@@ -42,9 +44,16 @@ export * from './env-bindings.js';
|
|
|
42
44
|
export * from './error-category-registry.js';
|
|
43
45
|
export * from './error-category.js';
|
|
44
46
|
export * from './error-envelope.js';
|
|
47
|
+
export * from './integration-connect-result.js';
|
|
48
|
+
export * from './integration-error-details.js';
|
|
49
|
+
export * from './integration-execute-request.js';
|
|
50
|
+
export * from './integration-execute-result.js';
|
|
51
|
+
export * from './kit-bundle-manifest.js';
|
|
52
|
+
export * from './kit-lock.js';
|
|
45
53
|
export * from './kvs-routing-entry.js';
|
|
46
54
|
export * from './promotion-request.js';
|
|
47
55
|
export * from './promotion-response.js';
|
|
56
|
+
export * from './saas-connection.js';
|
|
48
57
|
export * from './sanitized-binding-digest-helper.js';
|
|
49
58
|
export * from './sanitized-binding-evidence.js';
|
|
50
59
|
export * from './secret-reference.js';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// Code generated by tools/gen/gen.mjs from schema/*.json. DO NOT EDIT.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The `data` member of the connect (POST) and disconnect (DELETE) responses on /_harbour/integrations/connect. connected: this user's consent link for the app/environment/connection is ACTIVE (accountLabel is a display label, never an ID or token); consent_required: the user must follow authorizationUrl (governance OAuth start with an opaque ticket); disconnected: only this user's consent for this app/environment was revoked. Connect is a user action and never requests IT app approval.
|
|
6
|
+
*/
|
|
7
|
+
export type IntegrationConnectResult = {
|
|
8
|
+
status: 'connected' | 'consent_required' | 'disconnected';
|
|
9
|
+
accountLabel?: string;
|
|
10
|
+
authorizationUrl?: string;
|
|
11
|
+
} & (
|
|
12
|
+
| {
|
|
13
|
+
status?: 'connected';
|
|
14
|
+
}
|
|
15
|
+
| {
|
|
16
|
+
status?: 'consent_required';
|
|
17
|
+
}
|
|
18
|
+
| {
|
|
19
|
+
status?: 'disconnected';
|
|
20
|
+
}
|
|
21
|
+
);
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// Code generated by tools/gen/gen.mjs from schema/*.json. DO NOT EDIT.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* App-SDK HarbourErrorCategory values an integration route may emit; INTERNAL is reserved for the transport.
|
|
6
|
+
*/
|
|
7
|
+
export type IntegrationErrorCategory =
|
|
8
|
+
'AUTH_REQUIRED' | 'FORBIDDEN' | 'NOT_FOUND' | 'CONFLICT' | 'VALIDATION_FAILED' | 'RATE_LIMITED' | 'UNAVAILABLE';
|
|
9
|
+
/**
|
|
10
|
+
* Stable reason codes. SEND_OUTCOME_UNKNOWN: dispatch happened but the outcome is unknown; never re-post automatically. SEND_KEY_REUSED: the idempotency key was seen with a different payload or subject. GRANT_DENIED: IT denied the request. TOKEN_REFRESH_PENDING: another call holds the refresh lease; retry shortly. REQUEST_PENDING: a different request for this grant is still open.
|
|
11
|
+
*/
|
|
12
|
+
export type IntegrationErrorCode =
|
|
13
|
+
| 'USER_CONNECTION_REQUIRED'
|
|
14
|
+
| 'USER_RECONNECT_REQUIRED'
|
|
15
|
+
| 'GRANT_NOT_READY'
|
|
16
|
+
| 'GRANT_EXPIRED'
|
|
17
|
+
| 'GRANT_REVOKED'
|
|
18
|
+
| 'CONNECTION_DISABLED'
|
|
19
|
+
| 'OPERATION_NOT_DECLARED'
|
|
20
|
+
| 'RESOURCE_NOT_APPROVED'
|
|
21
|
+
| 'IDENTITY_MODE_MISMATCH'
|
|
22
|
+
| 'SEND_OUTCOME_UNKNOWN'
|
|
23
|
+
| 'SEND_KEY_REUSED'
|
|
24
|
+
| 'PROVIDER_RATE_LIMITED'
|
|
25
|
+
| 'PROVIDER_UNAVAILABLE'
|
|
26
|
+
| 'REQUEST_TOO_LARGE'
|
|
27
|
+
| 'RESULT_TOO_LARGE'
|
|
28
|
+
| 'DEADLINE_EXCEEDED'
|
|
29
|
+
| 'APP_ACCESS_REQUIRED'
|
|
30
|
+
| 'GRANT_DENIED'
|
|
31
|
+
| 'TOKEN_REFRESH_PENDING'
|
|
32
|
+
| 'REQUEST_PENDING';
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The `error` member of an integration failure response `{error, requestId}` on the execute/connect routes; the SDK maps it onto HarbourError(category, message, details). `category` is the app-SDK HarbourErrorCategory (not the deployment pipeline's dot-path error-category registry), with the HTTP status fixed per category: 401 AUTH_REQUIRED, 403 FORBIDDEN (denied/revoked/expired), 404 NOT_FOUND (unknown app/connection/resource), 409 CONFLICT (pending provisioning/consent/concurrent request), 400 or 413 VALIDATION_FAILED (invalid input / size overflow), 429 RATE_LIMITED (+ Retry-After header), 503 UNAVAILABLE. `details.code` is the closed stable reason set; `message` is human-facing and never carries provider error bodies, tokens or SQL.
|
|
36
|
+
*/
|
|
37
|
+
export interface IntegrationErrorDetails {
|
|
38
|
+
category: IntegrationErrorCategory;
|
|
39
|
+
message: string;
|
|
40
|
+
details: {
|
|
41
|
+
code: IntegrationErrorCode;
|
|
42
|
+
/**
|
|
43
|
+
* Mirrors the Retry-After header on RATE_LIMITED responses.
|
|
44
|
+
*/
|
|
45
|
+
retryAfterSeconds?: number;
|
|
46
|
+
};
|
|
47
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// Code generated by tools/gen/gen.mjs from schema/*.json. DO NOT EDIT.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Body of POST /_harbour/integrations/execute (app SDK), forwarded unchanged to the governance development and runtime execute routes. Exactly one declared operation against one declared resource. The identity mode is NOT a caller field: it is fixed by the operation and enforced from the approved grant; any identity/userId/scope field is rejected by additionalProperties. Per-operation input bounds: slack.channel.history {limit? 1..15, default 15}; slack.message.post {text 1..4000 chars} and a required idempotencyKey retained across retries of one explicit Send; warehouse.view.read {columns 1..32, limit? 1..1000, default 100}. Transport limits (not expressible here): request <= 16 KiB, total deadline 10 s.
|
|
6
|
+
*/
|
|
7
|
+
export type IntegrationExecuteRequest = {
|
|
8
|
+
/**
|
|
9
|
+
* Tenant-wide logical alias of a connection (governance sourceId) or of a resource under it.
|
|
10
|
+
*/
|
|
11
|
+
connection: string;
|
|
12
|
+
/**
|
|
13
|
+
* Closed operation set. Extending it is a contracts change.
|
|
14
|
+
*/
|
|
15
|
+
operation: 'slack.channel.history' | 'slack.message.post' | 'warehouse.view.read';
|
|
16
|
+
/**
|
|
17
|
+
* Tenant-wide logical alias of a connection (governance sourceId) or of a resource under it.
|
|
18
|
+
*/
|
|
19
|
+
resource: string;
|
|
20
|
+
input: {
|
|
21
|
+
limit?: number;
|
|
22
|
+
text?: string;
|
|
23
|
+
/**
|
|
24
|
+
* @minItems 1
|
|
25
|
+
* @maxItems 32
|
|
26
|
+
*/
|
|
27
|
+
columns?: string[];
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* UUID of one explicit Send action; required for slack.message.post only. The same key with the same payload and subject returns the recorded outcome for seven days.
|
|
31
|
+
*/
|
|
32
|
+
idempotencyKey?: string;
|
|
33
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// Code generated by tools/gen/gen.mjs from schema/*.json. DO NOT EDIT.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The `data` member of a successful execute response `{data, requestId}`; the SDK unwraps `data`. Exactly one of the three operation results: slack.channel.history -> {messages, hasMore} (plain text/IDs/time only, never the provider payload); slack.message.post -> {messageId}; warehouse.view.read -> {rows} (decimal/64-bit values as strings, dates as ISO strings). An unknown send outcome is never a result; it is an error with details.code SEND_OUTCOME_UNKNOWN. Results over 1 MiB are rejected, not truncated.
|
|
6
|
+
*/
|
|
7
|
+
export type IntegrationExecuteResult = {
|
|
8
|
+
/**
|
|
9
|
+
* @maxItems 15
|
|
10
|
+
*/
|
|
11
|
+
messages?: ChannelMessage[];
|
|
12
|
+
hasMore?: boolean;
|
|
13
|
+
messageId?: string;
|
|
14
|
+
/**
|
|
15
|
+
* @maxItems 1000
|
|
16
|
+
*/
|
|
17
|
+
rows?: {
|
|
18
|
+
[k: string]: unknown;
|
|
19
|
+
}[];
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export interface ChannelMessage {
|
|
23
|
+
id: string;
|
|
24
|
+
text: string;
|
|
25
|
+
authorId: string;
|
|
26
|
+
createdAt: string;
|
|
27
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// Code generated by tools/gen/gen.mjs from schema/*.json. DO NOT EDIT.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Digest-pinned image reference <repository>@sha256:<hex>; tags are never accepted.
|
|
6
|
+
*/
|
|
7
|
+
export type ImageDigestReference = string;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Identity of one published development-kit bundle (shipped with the CLI). It pins the app SDK tarball, the local runtime images and the agent-brief fingerprint that a kit-built app was developed against, so the hosted pipeline can prove compatibility before replacing the vendored SDK (see kit-lock.schema.json).
|
|
11
|
+
*/
|
|
12
|
+
export interface KitBundleManifest {
|
|
13
|
+
schema: 'harbour.kit-bundle/1.0';
|
|
14
|
+
/**
|
|
15
|
+
* The CLI package version that published this bundle.
|
|
16
|
+
*/
|
|
17
|
+
kitVersion: string;
|
|
18
|
+
sdk: {
|
|
19
|
+
package: '@harbour/app-sdk';
|
|
20
|
+
/**
|
|
21
|
+
* SHA-256 of the SDK tarball baked into this bundle; the CodeBuild gate compares it with the pipeline's own tarball.
|
|
22
|
+
*/
|
|
23
|
+
tarballSha256: string;
|
|
24
|
+
};
|
|
25
|
+
images: {
|
|
26
|
+
appGateway: ImageDigestReference;
|
|
27
|
+
sessionFixture: ImageDigestReference;
|
|
28
|
+
};
|
|
29
|
+
brief: {
|
|
30
|
+
/**
|
|
31
|
+
* SHA-256 of the agent-brief tar, or the literal unknown when the bundle carried no brief.
|
|
32
|
+
*/
|
|
33
|
+
fingerprint: string;
|
|
34
|
+
};
|
|
35
|
+
declarationSchema: 'harbour.app-integrations/2.0';
|
|
36
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// Code generated by tools/gen/gen.mjs from schema/*.json. DO NOT EDIT.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Committed `.harbour/kit.lock.json`: which app and tenant a kit-built app belongs to and the exact bundle it was developed against. The data-plane vendorAppSDK gate reads bundle.sdk.tarballSha256 and fails with kit_bundle_incompatible (naming both digests) when it differs from the baked tarball; apps without a kit.lock keep the existing path.
|
|
6
|
+
*/
|
|
7
|
+
export interface KitLock {
|
|
8
|
+
schema: 'harbour.kit-lock/1.0';
|
|
9
|
+
appId: string;
|
|
10
|
+
tenantId: string;
|
|
11
|
+
bundle: KitBundleManifest;
|
|
12
|
+
createdAt: string;
|
|
13
|
+
updatedAt: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Identity of one published development-kit bundle (shipped with the CLI). It pins the app SDK tarball, the local runtime images and the agent-brief fingerprint that a kit-built app was developed against, so the hosted pipeline can prove compatibility before replacing the vendored SDK (see kit-lock.schema.json).
|
|
17
|
+
*/
|
|
18
|
+
interface KitBundleManifest {
|
|
19
|
+
schema: 'harbour.kit-bundle/1.0';
|
|
20
|
+
/**
|
|
21
|
+
* The CLI package version that published this bundle.
|
|
22
|
+
*/
|
|
23
|
+
kitVersion: string;
|
|
24
|
+
sdk: {
|
|
25
|
+
package: '@harbour/app-sdk';
|
|
26
|
+
/**
|
|
27
|
+
* SHA-256 of the SDK tarball baked into this bundle; the CodeBuild gate compares it with the pipeline's own tarball.
|
|
28
|
+
*/
|
|
29
|
+
tarballSha256: string;
|
|
30
|
+
};
|
|
31
|
+
images: {
|
|
32
|
+
/**
|
|
33
|
+
* Digest-pinned image reference <repository>@sha256:<hex>; tags are never accepted.
|
|
34
|
+
*/
|
|
35
|
+
appGateway: string;
|
|
36
|
+
/**
|
|
37
|
+
* Digest-pinned image reference <repository>@sha256:<hex>; tags are never accepted.
|
|
38
|
+
*/
|
|
39
|
+
sessionFixture: string;
|
|
40
|
+
};
|
|
41
|
+
brief: {
|
|
42
|
+
/**
|
|
43
|
+
* SHA-256 of the agent-brief tar, or the literal unknown when the bundle carried no brief.
|
|
44
|
+
*/
|
|
45
|
+
fingerprint: string;
|
|
46
|
+
};
|
|
47
|
+
declarationSchema: 'harbour.app-integrations/2.0';
|
|
48
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// Code generated by tools/gen/gen.mjs from schema/*.json. DO NOT EDIT.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* DISABLED stops every app call immediately (details.code CONNECTION_DISABLED).
|
|
6
|
+
*/
|
|
7
|
+
export type SaasConnectionStatus = 'ACTIVE' | 'DISABLED';
|
|
8
|
+
export type InstallationName = string;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Tenant-wide SaaS connection record (control table sk SAASCONN#<sourceId>, same tenant partition as database sources; alias uniqueness is enforced across both). IT maps each environment to a provider installation and logical channel aliases to channel IDs; apps only ever see the aliases. Contains references, never secrets: the client secret lives in Secrets Manager under clientSecretRef and installation tokens under their own token records.
|
|
12
|
+
*/
|
|
13
|
+
export interface SaasConnection {
|
|
14
|
+
/**
|
|
15
|
+
* Tenant-wide logical alias of a connection (governance sourceId) or of a resource under it.
|
|
16
|
+
*/
|
|
17
|
+
sourceId: string;
|
|
18
|
+
kind: 'saas';
|
|
19
|
+
provider: 'slack';
|
|
20
|
+
displayName: string;
|
|
21
|
+
status: SaasConnectionStatus;
|
|
22
|
+
/**
|
|
23
|
+
* Optimistic-concurrency version; every write is conditional on it.
|
|
24
|
+
*/
|
|
25
|
+
version: number;
|
|
26
|
+
clientId: string;
|
|
27
|
+
/**
|
|
28
|
+
* secretref://tenant/{tenantId}/saas/{sourceId}/client
|
|
29
|
+
*/
|
|
30
|
+
clientSecretRef?: string;
|
|
31
|
+
environments: {
|
|
32
|
+
development?: SaasEnvironmentMapping;
|
|
33
|
+
preview?: SaasEnvironmentMapping;
|
|
34
|
+
production?: SaasEnvironmentMapping;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Operations IT allows apps to request on this connection.
|
|
38
|
+
*
|
|
39
|
+
* @minItems 1
|
|
40
|
+
* @maxItems 2
|
|
41
|
+
*/
|
|
42
|
+
operations: ('slack.channel.history' | 'slack.message.post')[];
|
|
43
|
+
developmentPreapproval: DevelopmentPreapproval;
|
|
44
|
+
/**
|
|
45
|
+
* Provider installations keyed by the installation name environments point at.
|
|
46
|
+
*/
|
|
47
|
+
installations?: {
|
|
48
|
+
[k: string]: SaasInstallation;
|
|
49
|
+
};
|
|
50
|
+
createdAt?: string;
|
|
51
|
+
updatedAt?: string;
|
|
52
|
+
}
|
|
53
|
+
export interface SaasEnvironmentMapping {
|
|
54
|
+
installation: InstallationName;
|
|
55
|
+
channels: {
|
|
56
|
+
/**
|
|
57
|
+
* Provider channel ID; only public, non-archived channels are valid.
|
|
58
|
+
*/
|
|
59
|
+
[k: string]: string;
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
export interface DevelopmentPreapproval {
|
|
63
|
+
/**
|
|
64
|
+
* Auto-approve development requests within the allowlist.
|
|
65
|
+
*/
|
|
66
|
+
enabled: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Development grant duration; default 24.
|
|
69
|
+
*/
|
|
70
|
+
hours: number;
|
|
71
|
+
}
|
|
72
|
+
export interface SaasInstallation {
|
|
73
|
+
tokenRecordId: string;
|
|
74
|
+
workspaceId: string;
|
|
75
|
+
botUserId: string;
|
|
76
|
+
status: 'ACTIVE' | 'RECONNECT_REQUIRED' | 'REVOKED';
|
|
77
|
+
}
|
package/package.json
CHANGED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "https://schemas.harbour.dev/app-integrations-declaration.schema.json",
|
|
4
|
+
"title": "AppIntegrationsDeclaration",
|
|
5
|
+
"description": "Committed `.harbour/integrations.json`: the app's declared use of tenant-wide integration connections. Keys are logical connection aliases (the governance sourceId); resources are logical names (Slack channel alias, warehouse view name), never IDs, tokens or URLs. The operation set is closed (three operations) and each operation carries a fixed identity mode: slack.channel.history=user, slack.message.post=app, warehouse.view.read=app. A `saas` connection may declare only the Slack operations and a `database` connection only warehouse.view.read. This file also owns the shared IntegrationOperation / IntegrationIdentityMode / IntegrationEnvironment / IntegrationConnectionKind enums referenced by the other integration schemas.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": ["schema", "connections"],
|
|
9
|
+
"properties": {
|
|
10
|
+
"schema": { "type": "string", "const": "harbour.app-integrations/2.0" },
|
|
11
|
+
"connections": {
|
|
12
|
+
"type": "object",
|
|
13
|
+
"minProperties": 1,
|
|
14
|
+
"maxProperties": 32,
|
|
15
|
+
"propertyNames": { "$ref": "#/definitions/IntegrationAlias" },
|
|
16
|
+
"additionalProperties": { "$ref": "#/definitions/DeclaredConnection" }
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"definitions": {
|
|
20
|
+
"IntegrationAlias": {
|
|
21
|
+
"type": "string",
|
|
22
|
+
"pattern": "^[a-z][a-z0-9_-]{0,62}$",
|
|
23
|
+
"description": "Tenant-wide logical alias of a connection (governance sourceId) or of a resource under it."
|
|
24
|
+
},
|
|
25
|
+
"IntegrationConnectionKind": { "type": "string", "enum": ["saas", "database"] },
|
|
26
|
+
"IntegrationOperation": {
|
|
27
|
+
"type": "string",
|
|
28
|
+
"enum": ["slack.channel.history", "slack.message.post", "warehouse.view.read"],
|
|
29
|
+
"description": "Closed operation set. Extending it is a contracts change."
|
|
30
|
+
},
|
|
31
|
+
"IntegrationIdentityMode": {
|
|
32
|
+
"type": "string",
|
|
33
|
+
"enum": ["app", "user"],
|
|
34
|
+
"description": "Whose authority an operation runs under. Fixed per operation; callers never choose it."
|
|
35
|
+
},
|
|
36
|
+
"IntegrationEnvironment": {
|
|
37
|
+
"type": "string",
|
|
38
|
+
"enum": ["development", "preview", "production"],
|
|
39
|
+
"description": "development is the CLI/local kit; preview and production are hosted."
|
|
40
|
+
},
|
|
41
|
+
"ResourceNames": {
|
|
42
|
+
"type": "array",
|
|
43
|
+
"minItems": 1,
|
|
44
|
+
"maxItems": 64,
|
|
45
|
+
"items": { "$ref": "#/definitions/IntegrationAlias" }
|
|
46
|
+
},
|
|
47
|
+
"ViewResource": {
|
|
48
|
+
"type": "object",
|
|
49
|
+
"additionalProperties": false,
|
|
50
|
+
"required": ["columns"],
|
|
51
|
+
"properties": {
|
|
52
|
+
"columns": {
|
|
53
|
+
"type": "array",
|
|
54
|
+
"minItems": 1,
|
|
55
|
+
"maxItems": 32,
|
|
56
|
+
"items": { "type": "string", "pattern": "^[A-Za-z_][A-Za-z0-9_]{0,127}$" }
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
"UserModeChannelOperation": {
|
|
61
|
+
"type": "object",
|
|
62
|
+
"additionalProperties": false,
|
|
63
|
+
"required": ["identity", "resources"],
|
|
64
|
+
"properties": {
|
|
65
|
+
"identity": { "type": "string", "const": "user" },
|
|
66
|
+
"resources": { "$ref": "#/definitions/ResourceNames" }
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"AppModeChannelOperation": {
|
|
70
|
+
"type": "object",
|
|
71
|
+
"additionalProperties": false,
|
|
72
|
+
"required": ["identity", "resources"],
|
|
73
|
+
"properties": {
|
|
74
|
+
"identity": { "type": "string", "const": "app" },
|
|
75
|
+
"resources": { "$ref": "#/definitions/ResourceNames" }
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
"AppModeViewOperation": {
|
|
79
|
+
"type": "object",
|
|
80
|
+
"additionalProperties": false,
|
|
81
|
+
"required": ["identity", "resources"],
|
|
82
|
+
"properties": {
|
|
83
|
+
"identity": { "type": "string", "const": "app" },
|
|
84
|
+
"resources": {
|
|
85
|
+
"type": "object",
|
|
86
|
+
"minProperties": 1,
|
|
87
|
+
"maxProperties": 64,
|
|
88
|
+
"propertyNames": { "$ref": "#/definitions/IntegrationAlias" },
|
|
89
|
+
"additionalProperties": { "$ref": "#/definitions/ViewResource" }
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
"DeclaredConnection": {
|
|
94
|
+
"type": "object",
|
|
95
|
+
"additionalProperties": false,
|
|
96
|
+
"required": ["kind", "operations"],
|
|
97
|
+
"properties": {
|
|
98
|
+
"kind": { "$ref": "#/definitions/IntegrationConnectionKind" },
|
|
99
|
+
"operations": {
|
|
100
|
+
"type": "object",
|
|
101
|
+
"additionalProperties": false,
|
|
102
|
+
"minProperties": 1,
|
|
103
|
+
"properties": {
|
|
104
|
+
"slack.channel.history": { "$ref": "#/definitions/UserModeChannelOperation" },
|
|
105
|
+
"slack.message.post": { "$ref": "#/definitions/AppModeChannelOperation" },
|
|
106
|
+
"warehouse.view.read": { "$ref": "#/definitions/AppModeViewOperation" }
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
"if": { "properties": { "kind": { "const": "saas" } } },
|
|
111
|
+
"then": { "properties": { "operations": { "not": { "required": ["warehouse.view.read"] } } } },
|
|
112
|
+
"else": {
|
|
113
|
+
"properties": {
|
|
114
|
+
"operations": {
|
|
115
|
+
"not": { "anyOf": [{ "required": ["slack.channel.history"] }, { "required": ["slack.message.post"] }] }
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
"examples": [
|
|
122
|
+
{
|
|
123
|
+
"schema": "harbour.app-integrations/2.0",
|
|
124
|
+
"connections": {
|
|
125
|
+
"company-slack": {
|
|
126
|
+
"kind": "saas",
|
|
127
|
+
"operations": {
|
|
128
|
+
"slack.channel.history": { "identity": "user", "resources": ["team-updates"] },
|
|
129
|
+
"slack.message.post": { "identity": "app", "resources": ["team-updates"] }
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
"sales-warehouse": {
|
|
133
|
+
"kind": "database",
|
|
134
|
+
"operations": {
|
|
135
|
+
"warehouse.view.read": {
|
|
136
|
+
"identity": "app",
|
|
137
|
+
"resources": { "weekly_sales": { "columns": ["week", "total"] } }
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
]
|
|
144
|
+
}
|