@mitralab.io/sdk-core 0.2.0-beta.0 → 0.2.0-beta.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.
package/dist/index.cjs CHANGED
@@ -848,24 +848,25 @@ function expectIntegrationTemplate(value, context, errors = defaultSdkCoreErrorF
848
848
  expectIntegrationLoginConfig(template.loginConfig, `${context} loginConfig`, errors);
849
849
  }
850
850
  expectIntegrationRequestConfig(template.requestConfig, `${context} requestConfig`, errors);
851
- expectObjectArray(template.fieldsSchema, `${context} fieldsSchema`, errors).forEach(
852
- (field, position) => {
853
- const fieldContext = `${context} field ${position}`;
854
- if (typeof field.key !== "string") invalidField(fieldContext, "key", errors);
855
- if (typeof field.label !== "string") invalidField(fieldContext, "label", errors);
856
- if (!isOneOf(field.type, ["url", "text", "secret"])) {
857
- invalidField(fieldContext, "type", errors);
858
- }
859
- if (typeof field.required !== "boolean") invalidField(fieldContext, "required", errors);
860
- if (!isNullableString(field.placeholder)) invalidField(fieldContext, "placeholder", errors);
861
- if (!isNullableString(field.default)) invalidField(fieldContext, "default", errors);
862
- }
863
- );
851
+ expectIntegrationFieldsSchema(template.fieldsSchema, `${context} fieldsSchema`, errors);
864
852
  if (!isNullableString(template.documentationUrl)) {
865
853
  invalidField(context, "documentationUrl", errors);
866
854
  }
867
855
  return template;
868
856
  }
857
+ function expectIntegrationFieldsSchema(value, context, errors) {
858
+ expectObjectArray(value, context, errors).forEach((field, position) => {
859
+ const fieldContext = `${context} field ${position}`;
860
+ if (typeof field.key !== "string") invalidField(fieldContext, "key", errors);
861
+ if (typeof field.label !== "string") invalidField(fieldContext, "label", errors);
862
+ if (!isOneOf(field.type, ["url", "text", "secret"])) {
863
+ invalidField(fieldContext, "type", errors);
864
+ }
865
+ if (typeof field.required !== "boolean") invalidField(fieldContext, "required", errors);
866
+ if (!isNullableString(field.placeholder)) invalidField(fieldContext, "placeholder", errors);
867
+ if (!isNullableString(field.default)) invalidField(fieldContext, "default", errors);
868
+ });
869
+ }
869
870
  function expectIntegrationLoginConfig(value, context, errors) {
870
871
  const config = expectObject(value, context, errors);
871
872
  if (!isNullableString(config.url)) invalidField(context, "url", errors);
@@ -912,13 +913,33 @@ function expectIntegrationRequestConfig(value, context, errors) {
912
913
  });
913
914
  }
914
915
  }
916
+ function expectInlineDefinition(config, context, errors) {
917
+ if (hasOwn(config, "fieldsSchemaInline") && config.fieldsSchemaInline !== null) {
918
+ expectIntegrationFieldsSchema(
919
+ config.fieldsSchemaInline,
920
+ `${context} fieldsSchemaInline`,
921
+ errors
922
+ );
923
+ }
924
+ if (hasOwn(config, "requestConfigInline") && config.requestConfigInline !== null) {
925
+ expectIntegrationRequestConfig(
926
+ config.requestConfigInline,
927
+ `${context} requestConfigInline`,
928
+ errors
929
+ );
930
+ }
931
+ if (hasOwn(config, "loginConfigInline") && config.loginConfigInline !== null) {
932
+ expectIntegrationLoginConfig(config.loginConfigInline, `${context} loginConfigInline`, errors);
933
+ }
934
+ }
915
935
  function expectTemplateConfigSummary(value, context, errors = defaultSdkCoreErrorFactory) {
916
936
  const config = expectObject(value, context, errors);
917
937
  if (typeof config.id !== "string") invalidField(context, "id", errors);
918
938
  if (!isNullableString(config.appId)) invalidField(context, "appId", errors);
919
939
  if (!isNullableInteger(config.legacyId)) invalidField(context, "legacyId", errors);
920
- if (typeof config.templateId !== "string") invalidField(context, "templateId", errors);
940
+ if (!isNullableString(config.templateId)) invalidField(context, "templateId", errors);
921
941
  if (typeof config.alias !== "string") invalidField(context, "alias", errors);
942
+ expectInlineDefinition(config, context, errors);
922
943
  if (config.status !== null && !isOneOf(config.status, ["unchecked", "connected", "error"])) {
923
944
  invalidField(context, "status", errors);
924
945
  }
package/dist/index.d.cts CHANGED
@@ -390,12 +390,26 @@ interface FunctionDefinition {
390
390
  createdAt: string | null;
391
391
  updatedAt: string;
392
392
  }
393
+ /**
394
+ * Creates an integration config from a catalog template or from an inline definition.
395
+ *
396
+ * Send exactly one of the two: either `templateId`, or the inline definition carried by
397
+ * `fieldsSchemaInline` and `requestConfigInline` with the optional `loginConfigInline`. Sending
398
+ * both or neither is rejected by the producer; Core does not check it locally. An inline
399
+ * definition connects a provider that has no template in the catalog.
400
+ */
393
401
  interface TemplateConfigCreateInput {
394
- /** Integration template UUID. */
395
- templateId: string;
402
+ /** Integration template UUID. Omitted when the inline definition is sent. */
403
+ templateId?: string | null;
396
404
  /** App-unique alias used by proxy execution. */
397
405
  alias: string;
398
406
  legacyId?: number;
407
+ /** Inline field definitions, in the same shape as a template `fieldsSchema`. */
408
+ fieldsSchemaInline?: IntegrationFieldSchemaInput[];
409
+ /** Inline header and credential placement rules, in the same shape as a template. */
410
+ requestConfigInline?: IntegrationRequestConfig;
411
+ /** Inline login handshake. Null when the provider authenticates on the request itself. */
412
+ loginConfigInline?: IntegrationLoginConfig | null;
399
413
  /** Complete credential and configuration map. Values are write-only. */
400
414
  values: Record<string, JsonValue>;
401
415
  }
@@ -422,8 +436,13 @@ interface TemplateConfigSummary {
422
436
  id: string;
423
437
  appId: string | null;
424
438
  legacyId: number | null;
425
- templateId: string;
439
+ /** Null on a config created from an inline definition. */
440
+ templateId: string | null;
426
441
  alias: string;
442
+ /** Inline definition echoed back. Absent or null on a template-backed config. */
443
+ fieldsSchemaInline?: IntegrationFieldSchema[] | null;
444
+ requestConfigInline?: IntegrationRequestConfig | null;
445
+ loginConfigInline?: IntegrationLoginConfig | null;
427
446
  status: IntegrationConnectionStatus | null;
428
447
  lastCheckedAt: string | null;
429
448
  }
@@ -440,8 +459,21 @@ interface ListTemplateConfigsOptions {
440
459
  size?: number;
441
460
  sort?: string;
442
461
  }
462
+ /**
463
+ * Tests credentials against a catalog template or against an inline definition.
464
+ *
465
+ * Follows the same exclusivity as `TemplateConfigCreateInput`: exactly one of `templateId` or the
466
+ * inline definition, checked by the producer and not by Core. Nothing is stored either way.
467
+ */
443
468
  interface TestCredentialsInput {
444
- templateId: string;
469
+ /** Integration template UUID. Omitted when the inline definition is sent. */
470
+ templateId?: string | null;
471
+ /** Inline field definitions, in the same shape as a template `fieldsSchema`. */
472
+ fieldsSchemaInline?: IntegrationFieldSchemaInput[];
473
+ /** Inline header and credential placement rules, in the same shape as a template. */
474
+ requestConfigInline?: IntegrationRequestConfig;
475
+ /** Inline login handshake. Null when the provider authenticates on the request itself. */
476
+ loginConfigInline?: IntegrationLoginConfig | null;
445
477
  values: Record<string, JsonValue>;
446
478
  }
447
479
  interface ConnectionTestResult {
@@ -964,6 +996,8 @@ interface IntegrationFieldSchema {
964
996
  placeholder: string | null;
965
997
  default: string | null;
966
998
  }
999
+ /** Inline field authoring shape. The producer stores an omitted `placeholder` or `default` as null. */
1000
+ type IntegrationFieldSchemaInput = Omit<IntegrationFieldSchema, "placeholder" | "default"> & Partial<Pick<IntegrationFieldSchema, "placeholder" | "default">>;
967
1001
  interface IntegrationTemplate extends IntegrationTemplateSummary {
968
1002
  loginConfig: IntegrationLoginConfig | null;
969
1003
  requestConfig: IntegrationRequestConfig;
@@ -1340,7 +1374,12 @@ interface FunctionsAdminModule {
1340
1374
  declare function createFunctionsAdminModule(transport: Transport, errors?: SdkCoreErrorFactory): FunctionsAdminModule;
1341
1375
 
1342
1376
  interface IntegrationAdminModule {
1343
- /** Creates one integration config. Secret values are write-only. */
1377
+ /**
1378
+ * Creates one integration config from a catalog template or from an inline definition.
1379
+ *
1380
+ * Secret values are write-only. Send `templateId` or the inline definition, never both: the
1381
+ * exclusivity is the producer's, so Core forwards whatever the caller sends.
1382
+ */
1344
1383
  create(input: TemplateConfigCreateInput): Promise<TemplateConfig>;
1345
1384
  /** Updates one config. Omitting `values` preserves stored credentials. */
1346
1385
  update(id: string, input: Omit<TemplateConfigUpdateInput, "configId">): Promise<TemplateConfig>;
@@ -1351,6 +1390,7 @@ interface IntegrationAdminModule {
1351
1390
  *
1352
1391
  * The whole batch is validated first, then items run in order, NOT atomically: read `results`
1353
1392
  * for the outcome of each one. `values` hold credentials and never come back in any response.
1393
+ * Each item independently chooses a catalog template or an inline definition.
1354
1394
  */
1355
1395
  bulkCreate(configs: TemplateConfigCreateInput[]): Promise<TemplateConfigBulkResult>;
1356
1396
  /**
@@ -1363,7 +1403,7 @@ interface IntegrationAdminModule {
1363
1403
  bulkUpdate(configs: TemplateConfigUpdateInput[]): Promise<TemplateConfigBulkResult>;
1364
1404
  /** Deletes 1 to 100 template configs by id, in order and NOT atomically. */
1365
1405
  bulkDelete(configIds: string[]): Promise<TemplateConfigBulkResult>;
1366
- /** Tests provisional credentials against a template without storing anything. */
1406
+ /** Tests provisional credentials against a template or inline definition, storing nothing. */
1367
1407
  testCredentials(request: TestCredentialsInput): Promise<ConnectionTestResult>;
1368
1408
  /** Tests a stored template config using the credentials it already holds. */
1369
1409
  testConfig(configId: string): Promise<ConnectionTestResult>;
@@ -1816,4 +1856,4 @@ declare function expectPage<T extends object>(value: unknown, context: string, e
1816
1856
  declare function expectLegacyPage<T extends object>(value: unknown, context: string, errors?: SdkCoreErrorFactory, validateItem?: (value: unknown, context: string, errors: SdkCoreErrorFactory) => T): LegacyPage<T>;
1817
1857
  declare function expectEmpty(value: unknown, context: string, errors?: SdkCoreErrorFactory): void;
1818
1858
 
1819
- export { type AgentBulkDeleteResult, type AgentConnection, type AgentConnectionCreateInput, type AgentConnectionsModule, type AgentCredentialsModule, type AgentDefinition, type AgentInput, type AgentMessage, type AgentModel, type AgentQueueItem, type AgentSendAndWaitOptions, type AgentSendOptions, type AgentSessionTransport, type AgentTask, type AgentTaskCreateInput, type AgentTaskEvent, type AgentTaskEventConnection, type AgentTaskEventObserver, type AgentTaskEventSource, type AgentTaskInput, type AgentTaskListOptions, type AgentTaskSession, type AgentTaskSessionEventMap, type AgentTaskSessionManager, type AgentTaskSessionManagerOptions, type AgentTaskSessionOptions, type AgentTaskSessionStatus, AgentTaskTurnError, type AgentTasksModule, type AgentTasksWithSessions, type AgentTimelineItem, type AgentToolEvent, type AgentTurnResult, type AgentUpdateItem, type AgentsModule, type AppColor, type AppContext, type AppCreateInput, type AppDefinition, type AppDeploy, type AppDomain, type AppFiles, type AppGetOptions, type AppListOptions, type AppMember, type AppPublishOptions, type AppSummary, type AppUpdateInput, type AppVersion, type AppVersionStatus, type AppsModule, type AuthModule, type AuthenticationResult, type BatchExecution, type BatchStatementResult, type BulkUnsubscribeResult, type ColumnInput, type ConnectionConfig, type ConnectionConfigResponse, type ConnectionTestResult, type ContextModule, type ContextModuleDependencies, type CopilotProvider, type CredentialStatus, type CustomQueriesModule, type CustomQueryDefinition, type CustomQueryInput, type CustomQuerySummary, type CustomQueryUpdateInput, type DataSourceBulkItemResult, type DataSourceBulkResult, type DataSourceCreateInput, type DataSourceDbType, type DataSourceDefinition, type DataSourceInstanceType, type DataSourceUpdateInput, type DataSourcesModule, type DdlStatement, type DeviceAuthorization, type DmlStatement, type EmptyFunctionInput, type EntitiesModule, type EntitiesProxy, type EntityListOptions, type EntityListResponse, type EntityTable, type ExistingAgentTaskSessionOptions, type FunctionBulkCreateInput, type FunctionBulkDeleteInput, type FunctionBulkDeleteResult, type FunctionBulkPatchInput, type FunctionBulkPatchItem, type FunctionBulkUpdateItem, type FunctionCreateInput, type FunctionDefinition, type FunctionExecution, type FunctionListOptions, type FunctionPatchInput, type FunctionRuntime, type FunctionSecrets, type FunctionSummary, type FunctionUpdateInput, type FunctionVersion, type FunctionVersionListOptions, type FunctionVisibility, type FunctionsAdminModule, type FunctionsModule, type FunctionsModuleOptions, type HttpMethod, type ImportColumnMapping, type ImportDefinition, type ImportExecution, type ImportExecutionListOptions, type ImportInput, type ImportProcessing, type ImportSchedule, type ImportSource, type ImportSourceResponse, type ImportTarget, type ImportsModule, type IntegrationAdminModule, type IntegrationConnectionStatus, type IntegrationCredentialRule, type IntegrationExecution, type IntegrationFieldSchema, type IntegrationLoginConfig, type IntegrationModule, type IntegrationProxyMode, type IntegrationRequestConfig, type IntegrationResource, type IntegrationResourceInput, type IntegrationResourceParam, type IntegrationResourceSummary, type IntegrationResourceUpdateInput, type IntegrationResourcesModule, type IntegrationTemplate, type IntegrationTemplateSummary, type IntegrationTemplateType, type IntegrationTemplatesModule, type IntegrationTokenExtraction, type InviteAppUserInput, type InvocationType, type JsonValue, type LegacyPage, type ListTablesOptions, type ListTemplateConfigsOptions, type MembersModule, type MessageAccepted, type MessengerModule, type NewAgentTaskSessionOptions, type OAuthExchangeInput, type OAuthStartResult, type Page, type PageOptions, type PlanPrice, type ProviderCredentialStatus, type ProxyInput, type ProxyResult, type PublicFunctionAsyncResult, type PublicFunctionResult, type PublicFunctionsModule, type QueriesModule, type QueryParamPrimitive, type QueryParamValue, type QueryResult, type SchemaModule, type SchemaScope, type SchemaTables, type SdkCore, SdkCoreConfigurationError, type SdkCoreErrorFactory, type SdkCoreOptions, SdkCoreResponseError, type SdkCoreTransports, type SqlModule, type TableColumn, type TableDefinition, type TableForeignKey, type TemplateConfig, type TemplateConfigBulkItemResult, type TemplateConfigBulkResult, type TemplateConfigCreateInput, type TemplateConfigPage, type TemplateConfigSummary, type TemplateConfigUpdateInput, type Tenant, type TestCredentialsInput, type Transport, type TransportRequestOptions, type User, type UserPlan, type WorkflowDefinition, type WorkflowExecution, type WorkflowInput, type WorkflowSummary, type WorkflowsModule, createAgentConnectionsModule, createAgentCredentialsModule, createAgentTaskSessionManager, createAgentTasksModule, createAgentsModule, createAppsModule, createAuthModule, createContextModule, createCustomQueriesModule, createDataSourcesModule, createEntitiesModule, createFunctionsAdminModule, createFunctionsModule, createImportsModule, createIntegrationAdminModule, createIntegrationModule, createIntegrationResourcesModule, createIntegrationTemplatesModule, createMembersModule, createMessengerModule, createPublicFunctionsModule, createQueriesModule, createSchemaModule, createSdkCore, createSqlModule, createWorkflowsModule, defaultSdkCoreErrorFactory, encodePathSegment, expectEmpty, expectLegacyPage, expectNullableObject, expectObject, expectObjectArray, expectPage, expectStringArray, toAgentTimelineItem, withAgentTaskSessions };
1859
+ export { type AgentBulkDeleteResult, type AgentConnection, type AgentConnectionCreateInput, type AgentConnectionsModule, type AgentCredentialsModule, type AgentDefinition, type AgentInput, type AgentMessage, type AgentModel, type AgentQueueItem, type AgentSendAndWaitOptions, type AgentSendOptions, type AgentSessionTransport, type AgentTask, type AgentTaskCreateInput, type AgentTaskEvent, type AgentTaskEventConnection, type AgentTaskEventObserver, type AgentTaskEventSource, type AgentTaskInput, type AgentTaskListOptions, type AgentTaskSession, type AgentTaskSessionEventMap, type AgentTaskSessionManager, type AgentTaskSessionManagerOptions, type AgentTaskSessionOptions, type AgentTaskSessionStatus, AgentTaskTurnError, type AgentTasksModule, type AgentTasksWithSessions, type AgentTimelineItem, type AgentToolEvent, type AgentTurnResult, type AgentUpdateItem, type AgentsModule, type AppColor, type AppContext, type AppCreateInput, type AppDefinition, type AppDeploy, type AppDomain, type AppFiles, type AppGetOptions, type AppListOptions, type AppMember, type AppPublishOptions, type AppSummary, type AppUpdateInput, type AppVersion, type AppVersionStatus, type AppsModule, type AuthModule, type AuthenticationResult, type BatchExecution, type BatchStatementResult, type BulkUnsubscribeResult, type ColumnInput, type ConnectionConfig, type ConnectionConfigResponse, type ConnectionTestResult, type ContextModule, type ContextModuleDependencies, type CopilotProvider, type CredentialStatus, type CustomQueriesModule, type CustomQueryDefinition, type CustomQueryInput, type CustomQuerySummary, type CustomQueryUpdateInput, type DataSourceBulkItemResult, type DataSourceBulkResult, type DataSourceCreateInput, type DataSourceDbType, type DataSourceDefinition, type DataSourceInstanceType, type DataSourceUpdateInput, type DataSourcesModule, type DdlStatement, type DeviceAuthorization, type DmlStatement, type EmptyFunctionInput, type EntitiesModule, type EntitiesProxy, type EntityListOptions, type EntityListResponse, type EntityTable, type ExistingAgentTaskSessionOptions, type FunctionBulkCreateInput, type FunctionBulkDeleteInput, type FunctionBulkDeleteResult, type FunctionBulkPatchInput, type FunctionBulkPatchItem, type FunctionBulkUpdateItem, type FunctionCreateInput, type FunctionDefinition, type FunctionExecution, type FunctionListOptions, type FunctionPatchInput, type FunctionRuntime, type FunctionSecrets, type FunctionSummary, type FunctionUpdateInput, type FunctionVersion, type FunctionVersionListOptions, type FunctionVisibility, type FunctionsAdminModule, type FunctionsModule, type FunctionsModuleOptions, type HttpMethod, type ImportColumnMapping, type ImportDefinition, type ImportExecution, type ImportExecutionListOptions, type ImportInput, type ImportProcessing, type ImportSchedule, type ImportSource, type ImportSourceResponse, type ImportTarget, type ImportsModule, type IntegrationAdminModule, type IntegrationConnectionStatus, type IntegrationCredentialRule, type IntegrationExecution, type IntegrationFieldSchema, type IntegrationFieldSchemaInput, type IntegrationLoginConfig, type IntegrationModule, type IntegrationProxyMode, type IntegrationRequestConfig, type IntegrationResource, type IntegrationResourceInput, type IntegrationResourceParam, type IntegrationResourceSummary, type IntegrationResourceUpdateInput, type IntegrationResourcesModule, type IntegrationTemplate, type IntegrationTemplateSummary, type IntegrationTemplateType, type IntegrationTemplatesModule, type IntegrationTokenExtraction, type InviteAppUserInput, type InvocationType, type JsonValue, type LegacyPage, type ListTablesOptions, type ListTemplateConfigsOptions, type MembersModule, type MessageAccepted, type MessengerModule, type NewAgentTaskSessionOptions, type OAuthExchangeInput, type OAuthStartResult, type Page, type PageOptions, type PlanPrice, type ProviderCredentialStatus, type ProxyInput, type ProxyResult, type PublicFunctionAsyncResult, type PublicFunctionResult, type PublicFunctionsModule, type QueriesModule, type QueryParamPrimitive, type QueryParamValue, type QueryResult, type SchemaModule, type SchemaScope, type SchemaTables, type SdkCore, SdkCoreConfigurationError, type SdkCoreErrorFactory, type SdkCoreOptions, SdkCoreResponseError, type SdkCoreTransports, type SqlModule, type TableColumn, type TableDefinition, type TableForeignKey, type TemplateConfig, type TemplateConfigBulkItemResult, type TemplateConfigBulkResult, type TemplateConfigCreateInput, type TemplateConfigPage, type TemplateConfigSummary, type TemplateConfigUpdateInput, type Tenant, type TestCredentialsInput, type Transport, type TransportRequestOptions, type User, type UserPlan, type WorkflowDefinition, type WorkflowExecution, type WorkflowInput, type WorkflowSummary, type WorkflowsModule, createAgentConnectionsModule, createAgentCredentialsModule, createAgentTaskSessionManager, createAgentTasksModule, createAgentsModule, createAppsModule, createAuthModule, createContextModule, createCustomQueriesModule, createDataSourcesModule, createEntitiesModule, createFunctionsAdminModule, createFunctionsModule, createImportsModule, createIntegrationAdminModule, createIntegrationModule, createIntegrationResourcesModule, createIntegrationTemplatesModule, createMembersModule, createMessengerModule, createPublicFunctionsModule, createQueriesModule, createSchemaModule, createSdkCore, createSqlModule, createWorkflowsModule, defaultSdkCoreErrorFactory, encodePathSegment, expectEmpty, expectLegacyPage, expectNullableObject, expectObject, expectObjectArray, expectPage, expectStringArray, toAgentTimelineItem, withAgentTaskSessions };
package/dist/index.d.ts CHANGED
@@ -390,12 +390,26 @@ interface FunctionDefinition {
390
390
  createdAt: string | null;
391
391
  updatedAt: string;
392
392
  }
393
+ /**
394
+ * Creates an integration config from a catalog template or from an inline definition.
395
+ *
396
+ * Send exactly one of the two: either `templateId`, or the inline definition carried by
397
+ * `fieldsSchemaInline` and `requestConfigInline` with the optional `loginConfigInline`. Sending
398
+ * both or neither is rejected by the producer; Core does not check it locally. An inline
399
+ * definition connects a provider that has no template in the catalog.
400
+ */
393
401
  interface TemplateConfigCreateInput {
394
- /** Integration template UUID. */
395
- templateId: string;
402
+ /** Integration template UUID. Omitted when the inline definition is sent. */
403
+ templateId?: string | null;
396
404
  /** App-unique alias used by proxy execution. */
397
405
  alias: string;
398
406
  legacyId?: number;
407
+ /** Inline field definitions, in the same shape as a template `fieldsSchema`. */
408
+ fieldsSchemaInline?: IntegrationFieldSchemaInput[];
409
+ /** Inline header and credential placement rules, in the same shape as a template. */
410
+ requestConfigInline?: IntegrationRequestConfig;
411
+ /** Inline login handshake. Null when the provider authenticates on the request itself. */
412
+ loginConfigInline?: IntegrationLoginConfig | null;
399
413
  /** Complete credential and configuration map. Values are write-only. */
400
414
  values: Record<string, JsonValue>;
401
415
  }
@@ -422,8 +436,13 @@ interface TemplateConfigSummary {
422
436
  id: string;
423
437
  appId: string | null;
424
438
  legacyId: number | null;
425
- templateId: string;
439
+ /** Null on a config created from an inline definition. */
440
+ templateId: string | null;
426
441
  alias: string;
442
+ /** Inline definition echoed back. Absent or null on a template-backed config. */
443
+ fieldsSchemaInline?: IntegrationFieldSchema[] | null;
444
+ requestConfigInline?: IntegrationRequestConfig | null;
445
+ loginConfigInline?: IntegrationLoginConfig | null;
427
446
  status: IntegrationConnectionStatus | null;
428
447
  lastCheckedAt: string | null;
429
448
  }
@@ -440,8 +459,21 @@ interface ListTemplateConfigsOptions {
440
459
  size?: number;
441
460
  sort?: string;
442
461
  }
462
+ /**
463
+ * Tests credentials against a catalog template or against an inline definition.
464
+ *
465
+ * Follows the same exclusivity as `TemplateConfigCreateInput`: exactly one of `templateId` or the
466
+ * inline definition, checked by the producer and not by Core. Nothing is stored either way.
467
+ */
443
468
  interface TestCredentialsInput {
444
- templateId: string;
469
+ /** Integration template UUID. Omitted when the inline definition is sent. */
470
+ templateId?: string | null;
471
+ /** Inline field definitions, in the same shape as a template `fieldsSchema`. */
472
+ fieldsSchemaInline?: IntegrationFieldSchemaInput[];
473
+ /** Inline header and credential placement rules, in the same shape as a template. */
474
+ requestConfigInline?: IntegrationRequestConfig;
475
+ /** Inline login handshake. Null when the provider authenticates on the request itself. */
476
+ loginConfigInline?: IntegrationLoginConfig | null;
445
477
  values: Record<string, JsonValue>;
446
478
  }
447
479
  interface ConnectionTestResult {
@@ -964,6 +996,8 @@ interface IntegrationFieldSchema {
964
996
  placeholder: string | null;
965
997
  default: string | null;
966
998
  }
999
+ /** Inline field authoring shape. The producer stores an omitted `placeholder` or `default` as null. */
1000
+ type IntegrationFieldSchemaInput = Omit<IntegrationFieldSchema, "placeholder" | "default"> & Partial<Pick<IntegrationFieldSchema, "placeholder" | "default">>;
967
1001
  interface IntegrationTemplate extends IntegrationTemplateSummary {
968
1002
  loginConfig: IntegrationLoginConfig | null;
969
1003
  requestConfig: IntegrationRequestConfig;
@@ -1340,7 +1374,12 @@ interface FunctionsAdminModule {
1340
1374
  declare function createFunctionsAdminModule(transport: Transport, errors?: SdkCoreErrorFactory): FunctionsAdminModule;
1341
1375
 
1342
1376
  interface IntegrationAdminModule {
1343
- /** Creates one integration config. Secret values are write-only. */
1377
+ /**
1378
+ * Creates one integration config from a catalog template or from an inline definition.
1379
+ *
1380
+ * Secret values are write-only. Send `templateId` or the inline definition, never both: the
1381
+ * exclusivity is the producer's, so Core forwards whatever the caller sends.
1382
+ */
1344
1383
  create(input: TemplateConfigCreateInput): Promise<TemplateConfig>;
1345
1384
  /** Updates one config. Omitting `values` preserves stored credentials. */
1346
1385
  update(id: string, input: Omit<TemplateConfigUpdateInput, "configId">): Promise<TemplateConfig>;
@@ -1351,6 +1390,7 @@ interface IntegrationAdminModule {
1351
1390
  *
1352
1391
  * The whole batch is validated first, then items run in order, NOT atomically: read `results`
1353
1392
  * for the outcome of each one. `values` hold credentials and never come back in any response.
1393
+ * Each item independently chooses a catalog template or an inline definition.
1354
1394
  */
1355
1395
  bulkCreate(configs: TemplateConfigCreateInput[]): Promise<TemplateConfigBulkResult>;
1356
1396
  /**
@@ -1363,7 +1403,7 @@ interface IntegrationAdminModule {
1363
1403
  bulkUpdate(configs: TemplateConfigUpdateInput[]): Promise<TemplateConfigBulkResult>;
1364
1404
  /** Deletes 1 to 100 template configs by id, in order and NOT atomically. */
1365
1405
  bulkDelete(configIds: string[]): Promise<TemplateConfigBulkResult>;
1366
- /** Tests provisional credentials against a template without storing anything. */
1406
+ /** Tests provisional credentials against a template or inline definition, storing nothing. */
1367
1407
  testCredentials(request: TestCredentialsInput): Promise<ConnectionTestResult>;
1368
1408
  /** Tests a stored template config using the credentials it already holds. */
1369
1409
  testConfig(configId: string): Promise<ConnectionTestResult>;
@@ -1816,4 +1856,4 @@ declare function expectPage<T extends object>(value: unknown, context: string, e
1816
1856
  declare function expectLegacyPage<T extends object>(value: unknown, context: string, errors?: SdkCoreErrorFactory, validateItem?: (value: unknown, context: string, errors: SdkCoreErrorFactory) => T): LegacyPage<T>;
1817
1857
  declare function expectEmpty(value: unknown, context: string, errors?: SdkCoreErrorFactory): void;
1818
1858
 
1819
- export { type AgentBulkDeleteResult, type AgentConnection, type AgentConnectionCreateInput, type AgentConnectionsModule, type AgentCredentialsModule, type AgentDefinition, type AgentInput, type AgentMessage, type AgentModel, type AgentQueueItem, type AgentSendAndWaitOptions, type AgentSendOptions, type AgentSessionTransport, type AgentTask, type AgentTaskCreateInput, type AgentTaskEvent, type AgentTaskEventConnection, type AgentTaskEventObserver, type AgentTaskEventSource, type AgentTaskInput, type AgentTaskListOptions, type AgentTaskSession, type AgentTaskSessionEventMap, type AgentTaskSessionManager, type AgentTaskSessionManagerOptions, type AgentTaskSessionOptions, type AgentTaskSessionStatus, AgentTaskTurnError, type AgentTasksModule, type AgentTasksWithSessions, type AgentTimelineItem, type AgentToolEvent, type AgentTurnResult, type AgentUpdateItem, type AgentsModule, type AppColor, type AppContext, type AppCreateInput, type AppDefinition, type AppDeploy, type AppDomain, type AppFiles, type AppGetOptions, type AppListOptions, type AppMember, type AppPublishOptions, type AppSummary, type AppUpdateInput, type AppVersion, type AppVersionStatus, type AppsModule, type AuthModule, type AuthenticationResult, type BatchExecution, type BatchStatementResult, type BulkUnsubscribeResult, type ColumnInput, type ConnectionConfig, type ConnectionConfigResponse, type ConnectionTestResult, type ContextModule, type ContextModuleDependencies, type CopilotProvider, type CredentialStatus, type CustomQueriesModule, type CustomQueryDefinition, type CustomQueryInput, type CustomQuerySummary, type CustomQueryUpdateInput, type DataSourceBulkItemResult, type DataSourceBulkResult, type DataSourceCreateInput, type DataSourceDbType, type DataSourceDefinition, type DataSourceInstanceType, type DataSourceUpdateInput, type DataSourcesModule, type DdlStatement, type DeviceAuthorization, type DmlStatement, type EmptyFunctionInput, type EntitiesModule, type EntitiesProxy, type EntityListOptions, type EntityListResponse, type EntityTable, type ExistingAgentTaskSessionOptions, type FunctionBulkCreateInput, type FunctionBulkDeleteInput, type FunctionBulkDeleteResult, type FunctionBulkPatchInput, type FunctionBulkPatchItem, type FunctionBulkUpdateItem, type FunctionCreateInput, type FunctionDefinition, type FunctionExecution, type FunctionListOptions, type FunctionPatchInput, type FunctionRuntime, type FunctionSecrets, type FunctionSummary, type FunctionUpdateInput, type FunctionVersion, type FunctionVersionListOptions, type FunctionVisibility, type FunctionsAdminModule, type FunctionsModule, type FunctionsModuleOptions, type HttpMethod, type ImportColumnMapping, type ImportDefinition, type ImportExecution, type ImportExecutionListOptions, type ImportInput, type ImportProcessing, type ImportSchedule, type ImportSource, type ImportSourceResponse, type ImportTarget, type ImportsModule, type IntegrationAdminModule, type IntegrationConnectionStatus, type IntegrationCredentialRule, type IntegrationExecution, type IntegrationFieldSchema, type IntegrationLoginConfig, type IntegrationModule, type IntegrationProxyMode, type IntegrationRequestConfig, type IntegrationResource, type IntegrationResourceInput, type IntegrationResourceParam, type IntegrationResourceSummary, type IntegrationResourceUpdateInput, type IntegrationResourcesModule, type IntegrationTemplate, type IntegrationTemplateSummary, type IntegrationTemplateType, type IntegrationTemplatesModule, type IntegrationTokenExtraction, type InviteAppUserInput, type InvocationType, type JsonValue, type LegacyPage, type ListTablesOptions, type ListTemplateConfigsOptions, type MembersModule, type MessageAccepted, type MessengerModule, type NewAgentTaskSessionOptions, type OAuthExchangeInput, type OAuthStartResult, type Page, type PageOptions, type PlanPrice, type ProviderCredentialStatus, type ProxyInput, type ProxyResult, type PublicFunctionAsyncResult, type PublicFunctionResult, type PublicFunctionsModule, type QueriesModule, type QueryParamPrimitive, type QueryParamValue, type QueryResult, type SchemaModule, type SchemaScope, type SchemaTables, type SdkCore, SdkCoreConfigurationError, type SdkCoreErrorFactory, type SdkCoreOptions, SdkCoreResponseError, type SdkCoreTransports, type SqlModule, type TableColumn, type TableDefinition, type TableForeignKey, type TemplateConfig, type TemplateConfigBulkItemResult, type TemplateConfigBulkResult, type TemplateConfigCreateInput, type TemplateConfigPage, type TemplateConfigSummary, type TemplateConfigUpdateInput, type Tenant, type TestCredentialsInput, type Transport, type TransportRequestOptions, type User, type UserPlan, type WorkflowDefinition, type WorkflowExecution, type WorkflowInput, type WorkflowSummary, type WorkflowsModule, createAgentConnectionsModule, createAgentCredentialsModule, createAgentTaskSessionManager, createAgentTasksModule, createAgentsModule, createAppsModule, createAuthModule, createContextModule, createCustomQueriesModule, createDataSourcesModule, createEntitiesModule, createFunctionsAdminModule, createFunctionsModule, createImportsModule, createIntegrationAdminModule, createIntegrationModule, createIntegrationResourcesModule, createIntegrationTemplatesModule, createMembersModule, createMessengerModule, createPublicFunctionsModule, createQueriesModule, createSchemaModule, createSdkCore, createSqlModule, createWorkflowsModule, defaultSdkCoreErrorFactory, encodePathSegment, expectEmpty, expectLegacyPage, expectNullableObject, expectObject, expectObjectArray, expectPage, expectStringArray, toAgentTimelineItem, withAgentTaskSessions };
1859
+ export { type AgentBulkDeleteResult, type AgentConnection, type AgentConnectionCreateInput, type AgentConnectionsModule, type AgentCredentialsModule, type AgentDefinition, type AgentInput, type AgentMessage, type AgentModel, type AgentQueueItem, type AgentSendAndWaitOptions, type AgentSendOptions, type AgentSessionTransport, type AgentTask, type AgentTaskCreateInput, type AgentTaskEvent, type AgentTaskEventConnection, type AgentTaskEventObserver, type AgentTaskEventSource, type AgentTaskInput, type AgentTaskListOptions, type AgentTaskSession, type AgentTaskSessionEventMap, type AgentTaskSessionManager, type AgentTaskSessionManagerOptions, type AgentTaskSessionOptions, type AgentTaskSessionStatus, AgentTaskTurnError, type AgentTasksModule, type AgentTasksWithSessions, type AgentTimelineItem, type AgentToolEvent, type AgentTurnResult, type AgentUpdateItem, type AgentsModule, type AppColor, type AppContext, type AppCreateInput, type AppDefinition, type AppDeploy, type AppDomain, type AppFiles, type AppGetOptions, type AppListOptions, type AppMember, type AppPublishOptions, type AppSummary, type AppUpdateInput, type AppVersion, type AppVersionStatus, type AppsModule, type AuthModule, type AuthenticationResult, type BatchExecution, type BatchStatementResult, type BulkUnsubscribeResult, type ColumnInput, type ConnectionConfig, type ConnectionConfigResponse, type ConnectionTestResult, type ContextModule, type ContextModuleDependencies, type CopilotProvider, type CredentialStatus, type CustomQueriesModule, type CustomQueryDefinition, type CustomQueryInput, type CustomQuerySummary, type CustomQueryUpdateInput, type DataSourceBulkItemResult, type DataSourceBulkResult, type DataSourceCreateInput, type DataSourceDbType, type DataSourceDefinition, type DataSourceInstanceType, type DataSourceUpdateInput, type DataSourcesModule, type DdlStatement, type DeviceAuthorization, type DmlStatement, type EmptyFunctionInput, type EntitiesModule, type EntitiesProxy, type EntityListOptions, type EntityListResponse, type EntityTable, type ExistingAgentTaskSessionOptions, type FunctionBulkCreateInput, type FunctionBulkDeleteInput, type FunctionBulkDeleteResult, type FunctionBulkPatchInput, type FunctionBulkPatchItem, type FunctionBulkUpdateItem, type FunctionCreateInput, type FunctionDefinition, type FunctionExecution, type FunctionListOptions, type FunctionPatchInput, type FunctionRuntime, type FunctionSecrets, type FunctionSummary, type FunctionUpdateInput, type FunctionVersion, type FunctionVersionListOptions, type FunctionVisibility, type FunctionsAdminModule, type FunctionsModule, type FunctionsModuleOptions, type HttpMethod, type ImportColumnMapping, type ImportDefinition, type ImportExecution, type ImportExecutionListOptions, type ImportInput, type ImportProcessing, type ImportSchedule, type ImportSource, type ImportSourceResponse, type ImportTarget, type ImportsModule, type IntegrationAdminModule, type IntegrationConnectionStatus, type IntegrationCredentialRule, type IntegrationExecution, type IntegrationFieldSchema, type IntegrationFieldSchemaInput, type IntegrationLoginConfig, type IntegrationModule, type IntegrationProxyMode, type IntegrationRequestConfig, type IntegrationResource, type IntegrationResourceInput, type IntegrationResourceParam, type IntegrationResourceSummary, type IntegrationResourceUpdateInput, type IntegrationResourcesModule, type IntegrationTemplate, type IntegrationTemplateSummary, type IntegrationTemplateType, type IntegrationTemplatesModule, type IntegrationTokenExtraction, type InviteAppUserInput, type InvocationType, type JsonValue, type LegacyPage, type ListTablesOptions, type ListTemplateConfigsOptions, type MembersModule, type MessageAccepted, type MessengerModule, type NewAgentTaskSessionOptions, type OAuthExchangeInput, type OAuthStartResult, type Page, type PageOptions, type PlanPrice, type ProviderCredentialStatus, type ProxyInput, type ProxyResult, type PublicFunctionAsyncResult, type PublicFunctionResult, type PublicFunctionsModule, type QueriesModule, type QueryParamPrimitive, type QueryParamValue, type QueryResult, type SchemaModule, type SchemaScope, type SchemaTables, type SdkCore, SdkCoreConfigurationError, type SdkCoreErrorFactory, type SdkCoreOptions, SdkCoreResponseError, type SdkCoreTransports, type SqlModule, type TableColumn, type TableDefinition, type TableForeignKey, type TemplateConfig, type TemplateConfigBulkItemResult, type TemplateConfigBulkResult, type TemplateConfigCreateInput, type TemplateConfigPage, type TemplateConfigSummary, type TemplateConfigUpdateInput, type Tenant, type TestCredentialsInput, type Transport, type TransportRequestOptions, type User, type UserPlan, type WorkflowDefinition, type WorkflowExecution, type WorkflowInput, type WorkflowSummary, type WorkflowsModule, createAgentConnectionsModule, createAgentCredentialsModule, createAgentTaskSessionManager, createAgentTasksModule, createAgentsModule, createAppsModule, createAuthModule, createContextModule, createCustomQueriesModule, createDataSourcesModule, createEntitiesModule, createFunctionsAdminModule, createFunctionsModule, createImportsModule, createIntegrationAdminModule, createIntegrationModule, createIntegrationResourcesModule, createIntegrationTemplatesModule, createMembersModule, createMessengerModule, createPublicFunctionsModule, createQueriesModule, createSchemaModule, createSdkCore, createSqlModule, createWorkflowsModule, defaultSdkCoreErrorFactory, encodePathSegment, expectEmpty, expectLegacyPage, expectNullableObject, expectObject, expectObjectArray, expectPage, expectStringArray, toAgentTimelineItem, withAgentTaskSessions };
package/dist/index.js CHANGED
@@ -783,24 +783,25 @@ function expectIntegrationTemplate(value, context, errors = defaultSdkCoreErrorF
783
783
  expectIntegrationLoginConfig(template.loginConfig, `${context} loginConfig`, errors);
784
784
  }
785
785
  expectIntegrationRequestConfig(template.requestConfig, `${context} requestConfig`, errors);
786
- expectObjectArray(template.fieldsSchema, `${context} fieldsSchema`, errors).forEach(
787
- (field, position) => {
788
- const fieldContext = `${context} field ${position}`;
789
- if (typeof field.key !== "string") invalidField(fieldContext, "key", errors);
790
- if (typeof field.label !== "string") invalidField(fieldContext, "label", errors);
791
- if (!isOneOf(field.type, ["url", "text", "secret"])) {
792
- invalidField(fieldContext, "type", errors);
793
- }
794
- if (typeof field.required !== "boolean") invalidField(fieldContext, "required", errors);
795
- if (!isNullableString(field.placeholder)) invalidField(fieldContext, "placeholder", errors);
796
- if (!isNullableString(field.default)) invalidField(fieldContext, "default", errors);
797
- }
798
- );
786
+ expectIntegrationFieldsSchema(template.fieldsSchema, `${context} fieldsSchema`, errors);
799
787
  if (!isNullableString(template.documentationUrl)) {
800
788
  invalidField(context, "documentationUrl", errors);
801
789
  }
802
790
  return template;
803
791
  }
792
+ function expectIntegrationFieldsSchema(value, context, errors) {
793
+ expectObjectArray(value, context, errors).forEach((field, position) => {
794
+ const fieldContext = `${context} field ${position}`;
795
+ if (typeof field.key !== "string") invalidField(fieldContext, "key", errors);
796
+ if (typeof field.label !== "string") invalidField(fieldContext, "label", errors);
797
+ if (!isOneOf(field.type, ["url", "text", "secret"])) {
798
+ invalidField(fieldContext, "type", errors);
799
+ }
800
+ if (typeof field.required !== "boolean") invalidField(fieldContext, "required", errors);
801
+ if (!isNullableString(field.placeholder)) invalidField(fieldContext, "placeholder", errors);
802
+ if (!isNullableString(field.default)) invalidField(fieldContext, "default", errors);
803
+ });
804
+ }
804
805
  function expectIntegrationLoginConfig(value, context, errors) {
805
806
  const config = expectObject(value, context, errors);
806
807
  if (!isNullableString(config.url)) invalidField(context, "url", errors);
@@ -847,13 +848,33 @@ function expectIntegrationRequestConfig(value, context, errors) {
847
848
  });
848
849
  }
849
850
  }
851
+ function expectInlineDefinition(config, context, errors) {
852
+ if (hasOwn(config, "fieldsSchemaInline") && config.fieldsSchemaInline !== null) {
853
+ expectIntegrationFieldsSchema(
854
+ config.fieldsSchemaInline,
855
+ `${context} fieldsSchemaInline`,
856
+ errors
857
+ );
858
+ }
859
+ if (hasOwn(config, "requestConfigInline") && config.requestConfigInline !== null) {
860
+ expectIntegrationRequestConfig(
861
+ config.requestConfigInline,
862
+ `${context} requestConfigInline`,
863
+ errors
864
+ );
865
+ }
866
+ if (hasOwn(config, "loginConfigInline") && config.loginConfigInline !== null) {
867
+ expectIntegrationLoginConfig(config.loginConfigInline, `${context} loginConfigInline`, errors);
868
+ }
869
+ }
850
870
  function expectTemplateConfigSummary(value, context, errors = defaultSdkCoreErrorFactory) {
851
871
  const config = expectObject(value, context, errors);
852
872
  if (typeof config.id !== "string") invalidField(context, "id", errors);
853
873
  if (!isNullableString(config.appId)) invalidField(context, "appId", errors);
854
874
  if (!isNullableInteger(config.legacyId)) invalidField(context, "legacyId", errors);
855
- if (typeof config.templateId !== "string") invalidField(context, "templateId", errors);
875
+ if (!isNullableString(config.templateId)) invalidField(context, "templateId", errors);
856
876
  if (typeof config.alias !== "string") invalidField(context, "alias", errors);
877
+ expectInlineDefinition(config, context, errors);
857
878
  if (config.status !== null && !isOneOf(config.status, ["unchecked", "connected", "error"])) {
858
879
  invalidField(context, "status", errors);
859
880
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mitralab.io/sdk-core",
3
- "version": "0.2.0-beta.0",
3
+ "version": "0.2.0-beta.1",
4
4
  "description": "Environment-neutral contracts and modules shared by Mitra JavaScript SDKs",
5
5
  "type": "module",
6
6
  "sideEffects": false,