@superblocksteam/shared 0.9562.5 → 0.9563.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/dist/constants.js +2 -1
- package/dist/constants.js.map +1 -1
- package/dist/constants.test.js +9 -1
- package/dist/constants.test.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/org-features/index.d.ts +44 -0
- package/dist/org-features/index.d.ts.map +1 -0
- package/dist/org-features/index.js +73 -0
- package/dist/org-features/index.js.map +1 -0
- package/dist/org-features/index.test.d.ts +2 -0
- package/dist/org-features/index.test.d.ts.map +1 -0
- package/dist/org-features/index.test.js +39 -0
- package/dist/org-features/index.test.js.map +1 -0
- package/dist/plugins/templates/bigquery.d.ts.map +1 -1
- package/dist/plugins/templates/bigquery.js +225 -1
- package/dist/plugins/templates/bigquery.js.map +1 -1
- package/dist/plugins/templates/databricks.d.ts.map +1 -1
- package/dist/plugins/templates/databricks.js +10 -0
- package/dist/plugins/templates/databricks.js.map +1 -1
- package/dist/plugins/templates/salesforce.d.ts +4 -0
- package/dist/plugins/templates/salesforce.d.ts.map +1 -1
- package/dist/plugins/templates/salesforce.js +207 -18
- package/dist/plugins/templates/salesforce.js.map +1 -1
- package/dist/plugins/templates/shared/auth.d.ts +12 -1
- package/dist/plugins/templates/shared/auth.d.ts.map +1 -1
- package/dist/plugins/templates/shared/auth.js +19 -4
- package/dist/plugins/templates/shared/auth.js.map +1 -1
- package/dist/socket/protocol.d.ts +4 -1
- package/dist/socket/protocol.d.ts.map +1 -1
- package/dist/socket/tracedSocket.d.ts +15 -0
- package/dist/socket/tracedSocket.d.ts.map +1 -1
- package/dist/socket/tracedSocket.js +15 -0
- package/dist/socket/tracedSocket.js.map +1 -1
- package/dist/types/ai/index.d.ts +2 -1
- package/dist/types/ai/index.d.ts.map +1 -1
- package/dist/types/ai/index.js +1 -0
- package/dist/types/ai/index.js.map +1 -1
- package/dist/types/datasource/auth.d.ts +1 -0
- package/dist/types/datasource/auth.d.ts.map +1 -1
- package/dist/types/datasource/auth.js +2 -0
- package/dist/types/datasource/auth.js.map +1 -1
- package/dist/types/datasource/index.d.ts +17 -6
- package/dist/types/datasource/index.d.ts.map +1 -1
- package/dist/types/datasource/index.js.map +1 -1
- package/dist/types/fact/fact.d.ts +52 -0
- package/dist/types/fact/fact.d.ts.map +1 -0
- package/dist/types/fact/fact.js +20 -0
- package/dist/types/fact/fact.js.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/integration/index.d.ts +6 -2
- package/dist/types/integration/index.d.ts.map +1 -1
- package/dist/types/integration/index.js +6 -2
- package/dist/types/integration/index.js.map +1 -1
- package/dist/types/organization/index.d.ts +5 -1
- package/dist/types/organization/index.d.ts.map +1 -1
- package/dist/types/organization/index.js +7 -3
- package/dist/types/organization/index.js.map +1 -1
- package/dist/types/rbac/index.d.ts +6 -0
- package/dist/types/rbac/index.d.ts.map +1 -1
- package/dist/types/rbac/index.js +6 -1
- package/dist/types/rbac/index.js.map +1 -1
- package/dist-esm/constants.js +2 -1
- package/dist-esm/constants.js.map +1 -1
- package/dist-esm/constants.test.js +9 -1
- package/dist-esm/constants.test.js.map +1 -1
- package/dist-esm/index.d.ts +1 -0
- package/dist-esm/index.d.ts.map +1 -1
- package/dist-esm/index.js +1 -0
- package/dist-esm/index.js.map +1 -1
- package/dist-esm/org-features/index.d.ts +44 -0
- package/dist-esm/org-features/index.d.ts.map +1 -0
- package/dist-esm/org-features/index.js +69 -0
- package/dist-esm/org-features/index.js.map +1 -0
- package/dist-esm/org-features/index.test.d.ts +2 -0
- package/dist-esm/org-features/index.test.d.ts.map +1 -0
- package/dist-esm/org-features/index.test.js +37 -0
- package/dist-esm/org-features/index.test.js.map +1 -0
- package/dist-esm/plugins/templates/bigquery.d.ts.map +1 -1
- package/dist-esm/plugins/templates/bigquery.js +226 -2
- package/dist-esm/plugins/templates/bigquery.js.map +1 -1
- package/dist-esm/plugins/templates/databricks.d.ts.map +1 -1
- package/dist-esm/plugins/templates/databricks.js +10 -0
- package/dist-esm/plugins/templates/databricks.js.map +1 -1
- package/dist-esm/plugins/templates/salesforce.d.ts +4 -0
- package/dist-esm/plugins/templates/salesforce.d.ts.map +1 -1
- package/dist-esm/plugins/templates/salesforce.js +193 -4
- package/dist-esm/plugins/templates/salesforce.js.map +1 -1
- package/dist-esm/plugins/templates/shared/auth.d.ts +12 -1
- package/dist-esm/plugins/templates/shared/auth.d.ts.map +1 -1
- package/dist-esm/plugins/templates/shared/auth.js +17 -2
- package/dist-esm/plugins/templates/shared/auth.js.map +1 -1
- package/dist-esm/socket/protocol.d.ts +4 -1
- package/dist-esm/socket/protocol.d.ts.map +1 -1
- package/dist-esm/socket/tracedSocket.d.ts +15 -0
- package/dist-esm/socket/tracedSocket.d.ts.map +1 -1
- package/dist-esm/socket/tracedSocket.js +15 -0
- package/dist-esm/socket/tracedSocket.js.map +1 -1
- package/dist-esm/types/ai/index.d.ts +2 -1
- package/dist-esm/types/ai/index.d.ts.map +1 -1
- package/dist-esm/types/ai/index.js +1 -0
- package/dist-esm/types/ai/index.js.map +1 -1
- package/dist-esm/types/datasource/auth.d.ts +1 -0
- package/dist-esm/types/datasource/auth.d.ts.map +1 -1
- package/dist-esm/types/datasource/auth.js +2 -0
- package/dist-esm/types/datasource/auth.js.map +1 -1
- package/dist-esm/types/datasource/index.d.ts +17 -6
- package/dist-esm/types/datasource/index.d.ts.map +1 -1
- package/dist-esm/types/datasource/index.js.map +1 -1
- package/dist-esm/types/fact/fact.d.ts +52 -0
- package/dist-esm/types/fact/fact.d.ts.map +1 -0
- package/dist-esm/types/fact/fact.js +17 -0
- package/dist-esm/types/fact/fact.js.map +1 -0
- package/dist-esm/types/index.d.ts +1 -0
- package/dist-esm/types/index.d.ts.map +1 -1
- package/dist-esm/types/index.js +1 -0
- package/dist-esm/types/index.js.map +1 -1
- package/dist-esm/types/integration/index.d.ts +6 -2
- package/dist-esm/types/integration/index.d.ts.map +1 -1
- package/dist-esm/types/integration/index.js +6 -2
- package/dist-esm/types/integration/index.js.map +1 -1
- package/dist-esm/types/organization/index.d.ts +5 -1
- package/dist-esm/types/organization/index.d.ts.map +1 -1
- package/dist-esm/types/organization/index.js +6 -2
- package/dist-esm/types/organization/index.js.map +1 -1
- package/dist-esm/types/rbac/index.d.ts +6 -0
- package/dist-esm/types/rbac/index.d.ts.map +1 -1
- package/dist-esm/types/rbac/index.js +6 -1
- package/dist-esm/types/rbac/index.js.map +1 -1
- package/package.json +2 -2
- package/src/constants.test.ts +9 -1
- package/src/constants.ts +2 -1
- package/src/index.ts +1 -0
- package/src/org-features/index.test.ts +42 -0
- package/src/org-features/index.ts +74 -0
- package/src/plugins/templates/bigquery.ts +240 -3
- package/src/plugins/templates/databricks.ts +10 -0
- package/src/plugins/templates/salesforce.ts +205 -4
- package/src/plugins/templates/shared/auth.ts +19 -1
- package/src/socket/protocol.ts +4 -1
- package/src/socket/tracedSocket.ts +15 -0
- package/src/types/ai/index.ts +2 -1
- package/src/types/datasource/auth.ts +2 -0
- package/src/types/datasource/index.ts +18 -6
- package/src/types/fact/fact.ts +56 -0
- package/src/types/index.ts +1 -0
- package/src/types/integration/index.ts +10 -2
- package/src/types/organization/index.ts +9 -3
- package/src/types/rbac/index.ts +6 -1
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Organization version-based feature gating module.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Organization version constants.
|
|
7
|
+
* - V1: Legacy organizations (version "1")
|
|
8
|
+
* - V2: New organizations (version "2")
|
|
9
|
+
*
|
|
10
|
+
* Note: The distinction between cloud-prem and hybrid-cloud deployments is
|
|
11
|
+
* determined by the SUPERBLOCKS_DEPLOYMENT_TYPE environment variable, not the org version.
|
|
12
|
+
*/
|
|
13
|
+
export const OrgVersion = {
|
|
14
|
+
V1: '1',
|
|
15
|
+
V2: '2'
|
|
16
|
+
} as const;
|
|
17
|
+
|
|
18
|
+
export type OrgVersionType = (typeof OrgVersion)[keyof typeof OrgVersion];
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Features that can be gated by organization version.
|
|
22
|
+
*/
|
|
23
|
+
export enum OrgFeature {
|
|
24
|
+
LegacyAuditLogs = 'LegacyAuditLogs',
|
|
25
|
+
LegacyObservability = 'LegacyObservability',
|
|
26
|
+
LegacySourceControl = 'LegacySourceControl',
|
|
27
|
+
LegacySuperblocksOcr = 'LegacySuperblocksOcr',
|
|
28
|
+
LegacySuperblocksEmail = 'LegacySuperblocksEmail',
|
|
29
|
+
LegacyGoogleSheets = 'LegacyGoogleSheets',
|
|
30
|
+
LegacyExecutionToken = 'LegacyExecutionToken',
|
|
31
|
+
LegacySecretsManagement = 'LegacySecretsManagement',
|
|
32
|
+
LegacyStreamingIntegrations = 'LegacyStreamingIntegrations',
|
|
33
|
+
InternalLegacyEndpoints = 'InternalLegacyEndpoints',
|
|
34
|
+
Workflows = 'Workflows',
|
|
35
|
+
ScheduledJobs = 'ScheduledJobs',
|
|
36
|
+
LegacyApps = 'LegacyApps',
|
|
37
|
+
ReactApps = 'ReactApps'
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Determines if an organization has access to a specific feature based on its version.
|
|
42
|
+
*
|
|
43
|
+
* @param orgVersion - The organization's version ('1' or '2'), or undefined during migration
|
|
44
|
+
* @param feature - The feature to check access for
|
|
45
|
+
* @returns true if the organization has access to the feature
|
|
46
|
+
*/
|
|
47
|
+
export function orgHasFeature(orgVersion: OrgVersionType | undefined, feature: OrgFeature): boolean {
|
|
48
|
+
switch (feature) {
|
|
49
|
+
// V1-only features (legacy organizations)
|
|
50
|
+
case OrgFeature.LegacyAuditLogs:
|
|
51
|
+
case OrgFeature.LegacyObservability:
|
|
52
|
+
case OrgFeature.LegacySourceControl:
|
|
53
|
+
case OrgFeature.LegacySuperblocksOcr:
|
|
54
|
+
case OrgFeature.LegacySuperblocksEmail:
|
|
55
|
+
case OrgFeature.LegacyGoogleSheets:
|
|
56
|
+
case OrgFeature.LegacyExecutionToken:
|
|
57
|
+
case OrgFeature.LegacySecretsManagement:
|
|
58
|
+
case OrgFeature.LegacyStreamingIntegrations:
|
|
59
|
+
case OrgFeature.InternalLegacyEndpoints:
|
|
60
|
+
case OrgFeature.Workflows:
|
|
61
|
+
case OrgFeature.ScheduledJobs:
|
|
62
|
+
case OrgFeature.LegacyApps:
|
|
63
|
+
return orgVersion === OrgVersion.V1;
|
|
64
|
+
|
|
65
|
+
// React apps are always available in V2 orgs.
|
|
66
|
+
// V1 orgs can also access React apps, but that's controlled by feature flags
|
|
67
|
+
// checked separately - this function only handles org-version gating.
|
|
68
|
+
case OrgFeature.ReactApps:
|
|
69
|
+
return orgVersion === OrgVersion.V2;
|
|
70
|
+
|
|
71
|
+
default:
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EditorLanguage, FormComponentType, Plugin, PluginResponseType, PluginType } from '../../types/index.js';
|
|
1
|
+
import { EditorLanguage, FormComponentType, InputDataType, Plugin, PluginResponseType, PluginType, FormItem } from '../../types/index.js';
|
|
2
2
|
import {
|
|
3
3
|
PARAMETERIZED_SQL_DESCRIPTION,
|
|
4
4
|
SERVICE_ACCOUNT_GHOST_TEXT,
|
|
@@ -6,13 +6,124 @@ import {
|
|
|
6
6
|
PUBLIC_INTEGRATIONS_LOGO_URL,
|
|
7
7
|
DOCS_BASE_URL
|
|
8
8
|
} from './constants.js';
|
|
9
|
+
import { makeDropdownItem } from './shared/db.js';
|
|
9
10
|
|
|
10
11
|
const BigQueryPluginVersions = {
|
|
11
12
|
V1: '0.0.1',
|
|
12
13
|
V2: '0.0.2',
|
|
13
14
|
V6: '0.0.6',
|
|
14
15
|
V7: '0.0.7',
|
|
15
|
-
V8: '0.0.8'
|
|
16
|
+
V8: '0.0.8',
|
|
17
|
+
V9: '0.0.9'
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
enum ConnectionType {
|
|
21
|
+
SERVICE_ACCOUNT_KEY = 'service-account-key',
|
|
22
|
+
WORKFORCE_IDENTITY_FEDERATION = 'oauth-token-exchange'
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const CONNECTION_METHODS_AND_DISPLAY_NAMES = {
|
|
26
|
+
[ConnectionType.SERVICE_ACCOUNT_KEY]: 'Service Account Key',
|
|
27
|
+
[ConnectionType.WORKFORCE_IDENTITY_FEDERATION]: 'Workforce Identity Federation'
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const BASE_SUBJECT_TOKEN_SOURCE = {
|
|
31
|
+
label: 'Subject token source',
|
|
32
|
+
name: 'authConfig.subjectTokenSource',
|
|
33
|
+
componentType: FormComponentType.DROPDOWN,
|
|
34
|
+
initialValue: 'SUBJECT_TOKEN_SOURCE_LOGIN_IDENTITY_PROVIDER',
|
|
35
|
+
rules: [{ required: true, message: 'Subject token source is required' }],
|
|
36
|
+
options: [
|
|
37
|
+
makeDropdownItem('SUBJECT_TOKEN_SOURCE_LOGIN_IDENTITY_PROVIDER', 'Login Identity Provider'),
|
|
38
|
+
makeDropdownItem('SUBJECT_TOKEN_SOURCE_STATIC_TOKEN', 'Static Token')
|
|
39
|
+
]
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const BASE_STATIC_TOKEN = {
|
|
43
|
+
label: 'Subject token',
|
|
44
|
+
name: 'authConfig.subjectTokenSourceStaticToken',
|
|
45
|
+
componentType: FormComponentType.INPUT_TEXT,
|
|
46
|
+
dataType: InputDataType.PASSWORD,
|
|
47
|
+
rules: [{ required: true, message: 'Static token is required when using static token source' }]
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const BASE_WORKFORCE_POOL_ID = {
|
|
51
|
+
label: 'Workforce Pool ID',
|
|
52
|
+
name: 'authConfig.workforcePoolId',
|
|
53
|
+
componentType: FormComponentType.INPUT_TEXT,
|
|
54
|
+
placeholder: 'my-workforce-pool',
|
|
55
|
+
rules: [{ required: true, message: 'Workforce Pool ID is required' }],
|
|
56
|
+
tooltip: {
|
|
57
|
+
markdownText: 'The workforce identity pool ID (POOL_ID)'
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const BASE_WORKFORCE_PROVIDER_ID = {
|
|
62
|
+
label: 'Workforce Provider ID',
|
|
63
|
+
name: 'authConfig.workforceProviderId',
|
|
64
|
+
componentType: FormComponentType.INPUT_TEXT,
|
|
65
|
+
placeholder: 'my-provider',
|
|
66
|
+
rules: [{ required: true, message: 'Workforce Provider ID is required' }],
|
|
67
|
+
tooltip: {
|
|
68
|
+
markdownText: 'The workforce identity pool provider ID (PROVIDER_ID)'
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const BASE_PROJECT_ID = {
|
|
73
|
+
label: 'Project ID',
|
|
74
|
+
name: 'authConfig.projectId',
|
|
75
|
+
componentType: FormComponentType.INPUT_TEXT,
|
|
76
|
+
placeholder: 'my-gcp-project',
|
|
77
|
+
rules: [{ required: true, message: 'Project ID is required' }],
|
|
78
|
+
tooltip: {
|
|
79
|
+
markdownText: 'The GCP project ID where BigQuery queries will run'
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const BASE_BILLING_PROJECT_NUMBER = {
|
|
84
|
+
label: 'Billing Project Number',
|
|
85
|
+
name: 'authConfig.billingProjectNumber',
|
|
86
|
+
componentType: FormComponentType.INPUT_TEXT,
|
|
87
|
+
placeholder: '123456789012',
|
|
88
|
+
rules: [{ required: false }],
|
|
89
|
+
tooltip: {
|
|
90
|
+
markdownText: 'Optional. The project number used for quota attribution during token exchange'
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
const HIDDEN_TOKEN_URL = {
|
|
95
|
+
label: 'Token URL',
|
|
96
|
+
name: 'authConfig.tokenUrl',
|
|
97
|
+
componentType: FormComponentType.INPUT_TEXT,
|
|
98
|
+
hidden: true,
|
|
99
|
+
initialValue: 'https://sts.googleapis.com/v1/token',
|
|
100
|
+
rules: [{ required: false }]
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
const HIDDEN_SCOPE = {
|
|
104
|
+
label: 'Scope',
|
|
105
|
+
name: 'authConfig.scope',
|
|
106
|
+
componentType: FormComponentType.INPUT_TEXT,
|
|
107
|
+
hidden: true,
|
|
108
|
+
initialValue: 'https://www.googleapis.com/auth/bigquery',
|
|
109
|
+
rules: [{ required: false }]
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
const HIDDEN_SUBJECT_TOKEN_TYPE = {
|
|
113
|
+
label: 'Subject token type',
|
|
114
|
+
name: 'authConfig.subjectTokenType',
|
|
115
|
+
componentType: FormComponentType.INPUT_TEXT,
|
|
116
|
+
hidden: true,
|
|
117
|
+
initialValue: 'urn:ietf:params:oauth:token-type:id_token',
|
|
118
|
+
rules: [{ required: false }]
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
const COMPUTED_AUDIENCE = {
|
|
122
|
+
label: 'Audience',
|
|
123
|
+
name: 'authConfig.audience',
|
|
124
|
+
componentType: FormComponentType.INPUT_TEXT,
|
|
125
|
+
hidden: true,
|
|
126
|
+
rules: [{ required: false }]
|
|
16
127
|
};
|
|
17
128
|
|
|
18
129
|
export const BigQueryPlugin: Plugin = {
|
|
@@ -40,17 +151,143 @@ export const BigQueryPlugin: Plugin = {
|
|
|
40
151
|
placeholder: 'BigQuery Production',
|
|
41
152
|
rules: [{ required: true, message: 'Display name is required' }]
|
|
42
153
|
},
|
|
154
|
+
{
|
|
155
|
+
label: 'Auth Type Field',
|
|
156
|
+
name: 'authTypeField',
|
|
157
|
+
hidden: true,
|
|
158
|
+
componentType: FormComponentType.INPUT_TEXT,
|
|
159
|
+
startVersion: BigQueryPluginVersions.V9,
|
|
160
|
+
initialValue: 'connectionType',
|
|
161
|
+
rules: [{ required: false }]
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
label: 'Authentication method',
|
|
165
|
+
name: 'connectionType',
|
|
166
|
+
startVersion: BigQueryPluginVersions.V9,
|
|
167
|
+
componentType: FormComponentType.DROPDOWN,
|
|
168
|
+
initialValue: ConnectionType.SERVICE_ACCOUNT_KEY,
|
|
169
|
+
rules: [{ required: true }],
|
|
170
|
+
options: Object.entries(CONNECTION_METHODS_AND_DISPLAY_NAMES).map(([value, displayName]) =>
|
|
171
|
+
makeDropdownItem(value, displayName)
|
|
172
|
+
)
|
|
173
|
+
} as FormItem,
|
|
43
174
|
{
|
|
44
175
|
label: 'Service account key',
|
|
45
176
|
name: 'authentication.custom.googleServiceAccount.value',
|
|
46
177
|
startVersion: BigQueryPluginVersions.V1,
|
|
178
|
+
endVersion: BigQueryPluginVersions.V8,
|
|
47
179
|
// INPUT_AREA is broken (cannot be udpated after unfocus). Using
|
|
48
180
|
// code editor for now.
|
|
49
181
|
componentType: FormComponentType.CODE_EDITOR,
|
|
50
182
|
language: EditorLanguage.JSON,
|
|
51
183
|
placeholder: SERVICE_ACCOUNT_GHOST_TEXT,
|
|
52
184
|
rules: [{ required: true, message: 'Service account key is required' }]
|
|
53
|
-
}
|
|
185
|
+
} as FormItem,
|
|
186
|
+
{
|
|
187
|
+
label: 'Service account key',
|
|
188
|
+
name: 'authentication.custom.googleServiceAccount.value',
|
|
189
|
+
startVersion: BigQueryPluginVersions.V9,
|
|
190
|
+
componentType: FormComponentType.CODE_EDITOR,
|
|
191
|
+
language: EditorLanguage.JSON,
|
|
192
|
+
placeholder: SERVICE_ACCOUNT_GHOST_TEXT,
|
|
193
|
+
rules: [{ required: true, message: 'Service account key is required' }],
|
|
194
|
+
display: {
|
|
195
|
+
show: {
|
|
196
|
+
connectionType: [ConnectionType.SERVICE_ACCOUNT_KEY]
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
} as FormItem,
|
|
200
|
+
{
|
|
201
|
+
...BASE_SUBJECT_TOKEN_SOURCE,
|
|
202
|
+
startVersion: BigQueryPluginVersions.V9,
|
|
203
|
+
display: {
|
|
204
|
+
show: {
|
|
205
|
+
connectionType: [ConnectionType.WORKFORCE_IDENTITY_FEDERATION]
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
} as FormItem,
|
|
209
|
+
{
|
|
210
|
+
...BASE_STATIC_TOKEN,
|
|
211
|
+
startVersion: BigQueryPluginVersions.V9,
|
|
212
|
+
display: {
|
|
213
|
+
show: {
|
|
214
|
+
connectionType: [ConnectionType.WORKFORCE_IDENTITY_FEDERATION],
|
|
215
|
+
'authConfig.subjectTokenSource': ['SUBJECT_TOKEN_SOURCE_STATIC_TOKEN']
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
} as FormItem,
|
|
219
|
+
{
|
|
220
|
+
...BASE_WORKFORCE_POOL_ID,
|
|
221
|
+
startVersion: BigQueryPluginVersions.V9,
|
|
222
|
+
display: {
|
|
223
|
+
show: {
|
|
224
|
+
connectionType: [ConnectionType.WORKFORCE_IDENTITY_FEDERATION]
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
} as FormItem,
|
|
228
|
+
{
|
|
229
|
+
...BASE_WORKFORCE_PROVIDER_ID,
|
|
230
|
+
startVersion: BigQueryPluginVersions.V9,
|
|
231
|
+
display: {
|
|
232
|
+
show: {
|
|
233
|
+
connectionType: [ConnectionType.WORKFORCE_IDENTITY_FEDERATION]
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
} as FormItem,
|
|
237
|
+
{
|
|
238
|
+
...BASE_PROJECT_ID,
|
|
239
|
+
startVersion: BigQueryPluginVersions.V9,
|
|
240
|
+
display: {
|
|
241
|
+
show: {
|
|
242
|
+
connectionType: [ConnectionType.WORKFORCE_IDENTITY_FEDERATION]
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
} as FormItem,
|
|
246
|
+
{
|
|
247
|
+
...BASE_BILLING_PROJECT_NUMBER,
|
|
248
|
+
startVersion: BigQueryPluginVersions.V9,
|
|
249
|
+
display: {
|
|
250
|
+
show: {
|
|
251
|
+
connectionType: [ConnectionType.WORKFORCE_IDENTITY_FEDERATION]
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
} as FormItem,
|
|
255
|
+
{
|
|
256
|
+
...HIDDEN_TOKEN_URL,
|
|
257
|
+
startVersion: BigQueryPluginVersions.V9,
|
|
258
|
+
display: {
|
|
259
|
+
show: {
|
|
260
|
+
connectionType: [ConnectionType.WORKFORCE_IDENTITY_FEDERATION]
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
} as FormItem,
|
|
264
|
+
{
|
|
265
|
+
...HIDDEN_SCOPE,
|
|
266
|
+
startVersion: BigQueryPluginVersions.V9,
|
|
267
|
+
display: {
|
|
268
|
+
show: {
|
|
269
|
+
connectionType: [ConnectionType.WORKFORCE_IDENTITY_FEDERATION]
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
} as FormItem,
|
|
273
|
+
{
|
|
274
|
+
...HIDDEN_SUBJECT_TOKEN_TYPE,
|
|
275
|
+
startVersion: BigQueryPluginVersions.V9,
|
|
276
|
+
display: {
|
|
277
|
+
show: {
|
|
278
|
+
connectionType: [ConnectionType.WORKFORCE_IDENTITY_FEDERATION]
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
} as FormItem,
|
|
282
|
+
{
|
|
283
|
+
...COMPUTED_AUDIENCE,
|
|
284
|
+
startVersion: BigQueryPluginVersions.V9,
|
|
285
|
+
display: {
|
|
286
|
+
show: {
|
|
287
|
+
connectionType: [ConnectionType.WORKFORCE_IDENTITY_FEDERATION]
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
} as FormItem
|
|
54
291
|
]
|
|
55
292
|
}
|
|
56
293
|
]
|
|
@@ -433,6 +433,16 @@ export const DatabricksPlugin: Plugin = {
|
|
|
433
433
|
{
|
|
434
434
|
name: 'main',
|
|
435
435
|
items: [
|
|
436
|
+
{
|
|
437
|
+
// Hidden operation field to prevent wrapStringInterpolation from adding backticks
|
|
438
|
+
label: 'Operation',
|
|
439
|
+
name: 'operation',
|
|
440
|
+
hidden: true,
|
|
441
|
+
startVersion: DatabricksPluginVersions.V1,
|
|
442
|
+
componentType: FormComponentType.DROPDOWN,
|
|
443
|
+
initialValue: 'SQL_OPERATION_RUN_SQL',
|
|
444
|
+
options: [makeDropdownItem('SQL_OPERATION_RUN_SQL', 'Run SQL')]
|
|
445
|
+
},
|
|
436
446
|
{
|
|
437
447
|
label: 'Parameters (:PARAM_1, :PARAM_2, ...)',
|
|
438
448
|
name: 'runSql.parameters',
|
|
@@ -2,17 +2,32 @@ import {
|
|
|
2
2
|
EditorLanguage,
|
|
3
3
|
ExtendedIntegrationPluginId,
|
|
4
4
|
FormComponentType,
|
|
5
|
+
FormItem,
|
|
6
|
+
InputDataType,
|
|
7
|
+
IntegrationAuthType,
|
|
5
8
|
Plugin,
|
|
6
9
|
PluginResponseType,
|
|
7
10
|
PluginType
|
|
8
11
|
} from '../../types/index.js';
|
|
12
|
+
import {
|
|
13
|
+
BASE_CLIENT_ID,
|
|
14
|
+
BASE_CLIENT_SECRET,
|
|
15
|
+
BASE_SCOPE,
|
|
16
|
+
BASE_SUBJECT_TOKEN_SOURCE,
|
|
17
|
+
BASE_SUBJECT_TOKEN_STATIC_TOKEN,
|
|
18
|
+
BASE_SUBJECT_TOKEN_TYPE,
|
|
19
|
+
BASE_TOKEN_URL
|
|
20
|
+
} from './shared/index.js';
|
|
9
21
|
import { PUBLIC_INTEGRATIONS_LOGO_URL, DOCS_BASE_URL } from './constants.js';
|
|
10
22
|
import { authSections } from './shared/index.js';
|
|
11
23
|
|
|
12
|
-
const SalesforcePluginVersions = {
|
|
13
|
-
V1: '0.0.1'
|
|
24
|
+
export const SalesforcePluginVersions = {
|
|
25
|
+
V1: '0.0.1',
|
|
26
|
+
V2: '0.0.2'
|
|
14
27
|
};
|
|
15
28
|
|
|
29
|
+
const CONNECTION_TYPE_FIELD = 'connection.auth.method.case';
|
|
30
|
+
|
|
16
31
|
const ACTION_DROPDOWN: { label: string; value: string; children: { label: string; value: string }[] }[] = [
|
|
17
32
|
{
|
|
18
33
|
label: 'Query with SOQL',
|
|
@@ -80,12 +95,198 @@ export const SalesforcePlugin: Plugin = {
|
|
|
80
95
|
startVersion: SalesforcePluginVersions.V1,
|
|
81
96
|
componentType: FormComponentType.INPUT_TEXT,
|
|
82
97
|
initialValue: '{{oauth.token}}',
|
|
83
|
-
hidden: true
|
|
84
|
-
|
|
98
|
+
hidden: true,
|
|
99
|
+
display: {
|
|
100
|
+
show: {
|
|
101
|
+
[CONNECTION_TYPE_FIELD]: ['clientCredentialsFlow']
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
name: 'connection.auth.method.case',
|
|
107
|
+
label: 'Authentication',
|
|
108
|
+
startVersion: SalesforcePluginVersions.V2,
|
|
109
|
+
componentType: FormComponentType.DROPDOWN,
|
|
110
|
+
initialValue: 'clientCredentialsFlow',
|
|
111
|
+
options: [
|
|
112
|
+
{
|
|
113
|
+
displayName: 'OAuth 2.0 Client Credentials Grant',
|
|
114
|
+
value: 'clientCredentialsFlow',
|
|
115
|
+
key: 'clientCredentialsFlow'
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
displayName: 'OAuth 2.0 Token Exchange',
|
|
119
|
+
value: IntegrationAuthType.OAUTH2_TOKEN_EXCHANGE_PROTO,
|
|
120
|
+
key: IntegrationAuthType.OAUTH2_TOKEN_EXCHANGE_PROTO
|
|
121
|
+
}
|
|
122
|
+
]
|
|
123
|
+
},
|
|
124
|
+
// CLIENT CREDENTIALS FLOW
|
|
125
|
+
{
|
|
126
|
+
label: 'Token URL',
|
|
127
|
+
name: 'connection.auth.method.value.tokenUrl',
|
|
128
|
+
startVersion: SalesforcePluginVersions.V2,
|
|
129
|
+
componentType: FormComponentType.DYNAMIC_INPUT_TEXT,
|
|
130
|
+
rules: [{ required: true, message: 'Token URL is required' }],
|
|
131
|
+
tooltip: {
|
|
132
|
+
markdownText: `The endpoint for authorization server. This is used to get the access token.`
|
|
133
|
+
},
|
|
134
|
+
singleLine: true,
|
|
135
|
+
display: {
|
|
136
|
+
show: {
|
|
137
|
+
'connection.auth.method.case': ['clientCredentialsFlow']
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
placeholder: 'https://login.salesforce.com/services/oauth2/token'
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
label: 'Consumer key',
|
|
144
|
+
name: 'connection.auth.method.value.clientId',
|
|
145
|
+
startVersion: SalesforcePluginVersions.V2,
|
|
146
|
+
componentType: FormComponentType.DYNAMIC_INPUT_TEXT,
|
|
147
|
+
placeholder: `my consumer key`,
|
|
148
|
+
rules: [{ required: true, message: 'Consumer Key is required' }],
|
|
149
|
+
tooltip: {
|
|
150
|
+
markdownText: `A public identifier used to identify this Salesforce consumer
|
|
151
|
+
to the authorization/token servers.`
|
|
152
|
+
},
|
|
153
|
+
singleLine: true,
|
|
154
|
+
display: {
|
|
155
|
+
show: {
|
|
156
|
+
'connection.auth.method.case': ['clientCredentialsFlow']
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
label: 'Consumer secret',
|
|
162
|
+
name: 'connection.auth.method.value.clientSecret',
|
|
163
|
+
startVersion: SalesforcePluginVersions.V2,
|
|
164
|
+
componentType: FormComponentType.INPUT_TEXT,
|
|
165
|
+
rules: [{ required: true, message: 'Consumer secret is required' }],
|
|
166
|
+
placeholder: `my consumer secret`,
|
|
167
|
+
dataType: InputDataType.PASSWORD,
|
|
168
|
+
tooltip: {
|
|
169
|
+
markdownText: `A secret shared between the Salesforce consumer and the
|
|
170
|
+
authorizing/token servers to verify the Consumer Key.`
|
|
171
|
+
},
|
|
172
|
+
singleLine: false,
|
|
173
|
+
display: {
|
|
174
|
+
show: {
|
|
175
|
+
'connection.auth.method.case': ['clientCredentialsFlow']
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
// OAUTH2 TOKEN EXCHANGE
|
|
180
|
+
// This is a field that will always be hidden to users.
|
|
181
|
+
// It exists to tell the agent WHERE to look on the datasource configuration for the authType.
|
|
182
|
+
// For more info, see addTokenIfNeeded.go in the orchestrator.
|
|
183
|
+
{
|
|
184
|
+
label: '',
|
|
185
|
+
name: 'authTypeField',
|
|
186
|
+
hidden: true,
|
|
187
|
+
initialValue: 'authTypeOnBehalfOfToken',
|
|
188
|
+
componentType: FormComponentType.INPUT_TEXT,
|
|
189
|
+
rules: [{ required: false }],
|
|
190
|
+
startVersion: SalesforcePluginVersions.V2,
|
|
191
|
+
// This is a newer convention in the agent that allows us to specify the field to look at
|
|
192
|
+
// when determining authType. We only include this for OAUTH2_TOKEN_EXCHANGE so the
|
|
193
|
+
// existing clientCredentialsFlow works as-is.
|
|
194
|
+
// See: https://github.com/superblocksteam/orchestrator/blob/main/internal/auth/add_token_if_needed.go
|
|
195
|
+
display: {
|
|
196
|
+
show: {
|
|
197
|
+
[CONNECTION_TYPE_FIELD]: [IntegrationAuthType.OAUTH2_TOKEN_EXCHANGE_PROTO]
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
// Another field to send a value to the orchestrator. We need this because our current
|
|
202
|
+
// templates make it difficult/impossible to change the value of a field programmatically.
|
|
203
|
+
// Ideally the value for authType would be dependent upon which connection type the user
|
|
204
|
+
// has selected.
|
|
205
|
+
{
|
|
206
|
+
label: '',
|
|
207
|
+
name: 'authTypeOnBehalfOfToken',
|
|
208
|
+
hidden: true,
|
|
209
|
+
initialValue: 'oauth-token-exchange',
|
|
210
|
+
componentType: FormComponentType.INPUT_TEXT,
|
|
211
|
+
startVersion: SalesforcePluginVersions.V2,
|
|
212
|
+
display: {
|
|
213
|
+
show: {
|
|
214
|
+
[CONNECTION_TYPE_FIELD]: [IntegrationAuthType.OAUTH2_TOKEN_EXCHANGE_PROTO]
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
...BASE_SUBJECT_TOKEN_SOURCE,
|
|
220
|
+
startVersion: SalesforcePluginVersions.V2,
|
|
221
|
+
display: {
|
|
222
|
+
show: {
|
|
223
|
+
[CONNECTION_TYPE_FIELD]: [IntegrationAuthType.OAUTH2_TOKEN_EXCHANGE_PROTO]
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
} as FormItem,
|
|
227
|
+
{
|
|
228
|
+
...BASE_SUBJECT_TOKEN_STATIC_TOKEN,
|
|
229
|
+
startVersion: SalesforcePluginVersions.V2,
|
|
230
|
+
display: {
|
|
231
|
+
show: {
|
|
232
|
+
[CONNECTION_TYPE_FIELD]: [IntegrationAuthType.OAUTH2_TOKEN_EXCHANGE_PROTO],
|
|
233
|
+
'authConfig.subjectTokenSource': ['SUBJECT_TOKEN_SOURCE_STATIC_TOKEN']
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
} as FormItem,
|
|
237
|
+
{
|
|
238
|
+
...BASE_SUBJECT_TOKEN_TYPE,
|
|
239
|
+
startVersion: SalesforcePluginVersions.V2,
|
|
240
|
+
placeholder: 'urn:ietf:params:oauth:token-type:access_token',
|
|
241
|
+
display: {
|
|
242
|
+
show: {
|
|
243
|
+
[CONNECTION_TYPE_FIELD]: [IntegrationAuthType.OAUTH2_TOKEN_EXCHANGE_PROTO]
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
} as FormItem,
|
|
247
|
+
{
|
|
248
|
+
...BASE_TOKEN_URL,
|
|
249
|
+
startVersion: SalesforcePluginVersions.V2,
|
|
250
|
+
display: {
|
|
251
|
+
show: {
|
|
252
|
+
[CONNECTION_TYPE_FIELD]: [IntegrationAuthType.OAUTH2_TOKEN_EXCHANGE_PROTO]
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
} as FormItem,
|
|
256
|
+
{
|
|
257
|
+
...BASE_CLIENT_ID,
|
|
258
|
+
startVersion: SalesforcePluginVersions.V2,
|
|
259
|
+
rules: [{ required: false }],
|
|
260
|
+
display: {
|
|
261
|
+
show: {
|
|
262
|
+
[CONNECTION_TYPE_FIELD]: [IntegrationAuthType.OAUTH2_TOKEN_EXCHANGE_PROTO]
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
} as FormItem,
|
|
266
|
+
{
|
|
267
|
+
...BASE_CLIENT_SECRET,
|
|
268
|
+
startVersion: SalesforcePluginVersions.V2,
|
|
269
|
+
rules: [{ required: false }],
|
|
270
|
+
display: {
|
|
271
|
+
show: {
|
|
272
|
+
[CONNECTION_TYPE_FIELD]: [IntegrationAuthType.OAUTH2_TOKEN_EXCHANGE_PROTO]
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
} as FormItem,
|
|
276
|
+
{
|
|
277
|
+
...BASE_SCOPE,
|
|
278
|
+
startVersion: SalesforcePluginVersions.V2,
|
|
279
|
+
display: {
|
|
280
|
+
show: {
|
|
281
|
+
[CONNECTION_TYPE_FIELD]: [IntegrationAuthType.OAUTH2_TOKEN_EXCHANGE_PROTO]
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
} as FormItem
|
|
85
285
|
]
|
|
86
286
|
},
|
|
87
287
|
...authSections({
|
|
88
288
|
startVersion: SalesforcePluginVersions.V1,
|
|
289
|
+
endVersion: SalesforcePluginVersions.V1,
|
|
89
290
|
pluginId: ExtendedIntegrationPluginId.SALESFORCE,
|
|
90
291
|
pluginName: 'Salesforce',
|
|
91
292
|
defaultMethod: 'clientCredentialsFlow',
|
|
@@ -98,6 +98,7 @@ const AUTH_METHODS_TO_TYPES = {
|
|
|
98
98
|
|
|
99
99
|
export const authSections = ({
|
|
100
100
|
startVersion,
|
|
101
|
+
endVersion,
|
|
101
102
|
pluginId,
|
|
102
103
|
pluginName,
|
|
103
104
|
defaultMethod,
|
|
@@ -109,6 +110,7 @@ export const authSections = ({
|
|
|
109
110
|
prependItems = []
|
|
110
111
|
}: {
|
|
111
112
|
startVersion: string;
|
|
113
|
+
endVersion?: string;
|
|
112
114
|
pluginId: ExtendedIntegrationPluginId;
|
|
113
115
|
pluginName: string;
|
|
114
116
|
enabledMethods: AuthMethods;
|
|
@@ -1393,6 +1395,22 @@ export const authSections = ({
|
|
|
1393
1395
|
]
|
|
1394
1396
|
});
|
|
1395
1397
|
|
|
1398
|
+
// Apply endVersion to all items so callers can cap the version range of the entire auth section.
|
|
1399
|
+
if (endVersion) {
|
|
1400
|
+
for (const section of formSections) {
|
|
1401
|
+
for (const item of section.items) {
|
|
1402
|
+
if ('startVersion' in item) {
|
|
1403
|
+
(item as FormItem).endVersion = (item as FormItem).endVersion ?? endVersion;
|
|
1404
|
+
}
|
|
1405
|
+
if ('rowItems' in item) {
|
|
1406
|
+
for (const rowItem of (item as { rowItems: FormItem[] }).rowItems) {
|
|
1407
|
+
rowItem.endVersion = rowItem.endVersion ?? endVersion;
|
|
1408
|
+
}
|
|
1409
|
+
}
|
|
1410
|
+
}
|
|
1411
|
+
}
|
|
1412
|
+
}
|
|
1413
|
+
|
|
1396
1414
|
return formSections;
|
|
1397
1415
|
};
|
|
1398
1416
|
|
|
@@ -1582,7 +1600,7 @@ export const BASE_SUBJECT_TOKEN_SOURCE = {
|
|
|
1582
1600
|
singleLine: false
|
|
1583
1601
|
};
|
|
1584
1602
|
|
|
1585
|
-
const BASE_SUBJECT_TOKEN_TYPE = {
|
|
1603
|
+
export const BASE_SUBJECT_TOKEN_TYPE = {
|
|
1586
1604
|
label: 'Subject token type',
|
|
1587
1605
|
name: 'authConfig.subjectTokenType',
|
|
1588
1606
|
componentType: FormComponentType.INPUT_TEXT,
|
package/src/socket/protocol.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { DirectoryEntry, PutManyRequestPayload, PutManyResponsePayload } from '../dbfs/types.js';
|
|
4
4
|
import { ApiToSign, ApiToVerify, AppToSign, AppToVerify, ApplicationSignatureTreeSigned, Signature } from '../signing/constants.js';
|
|
5
|
-
import { AiChatMessageDto, AiChatMessagePayload, AiWorkflowEvent } from '../types/index.js';
|
|
5
|
+
import { AiChatMessageDto, AiChatMessagePayload, AiWorkflowEvent, FactListQuery, ListFactsResponse } from '../types/index.js';
|
|
6
6
|
import {
|
|
7
7
|
ApplicationConfiguration,
|
|
8
8
|
ApplicationPageClonePayload,
|
|
@@ -135,6 +135,9 @@ export interface ServerMethods {
|
|
|
135
135
|
};
|
|
136
136
|
};
|
|
137
137
|
};
|
|
138
|
+
fact: {
|
|
139
|
+
list: ServerMethodSchema<FactListQuery, ListFactsResponse>;
|
|
140
|
+
};
|
|
138
141
|
};
|
|
139
142
|
v2: {
|
|
140
143
|
application: {
|
|
@@ -58,6 +58,21 @@ function setHttpStatusFromError(span: Span, error: Error): void {
|
|
|
58
58
|
span.setStatus({ code: SpanStatusCode.ERROR, message: error.message });
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
+
/**
|
|
62
|
+
* @deprecated Use `TracedSocket` from `@superblocksteam/telemetry` instead.
|
|
63
|
+
* This class will be removed in a future version.
|
|
64
|
+
*
|
|
65
|
+
* Migration:
|
|
66
|
+
* ```typescript
|
|
67
|
+
* // Before
|
|
68
|
+
* import { TracedSocket } from '@superblocksteam/shared';
|
|
69
|
+
*
|
|
70
|
+
* // After
|
|
71
|
+
* import { TracedSocket, getTelemetryInstance } from '@superblocksteam/telemetry';
|
|
72
|
+
* const { policyEvaluator } = getTelemetryInstance();
|
|
73
|
+
* new TracedSocket(ws, handlers, middlewares, { requestHeaders, policyEvaluator }, options);
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
61
76
|
export class TracedSocket<ImplementedMethods, CallableMethods, RequestContext extends RequestContextBase> extends ISocket<
|
|
62
77
|
ImplementedMethods,
|
|
63
78
|
CallableMethods,
|