skedyul 0.2.131 → 0.2.134

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/.build-stamp CHANGED
@@ -1 +1 @@
1
- 1770072046740
1
+ 1770160446171
package/dist/config.d.ts CHANGED
@@ -636,7 +636,7 @@ export interface WebhookHandlerDefinition {
636
636
  handler: WebhookHandlerFn;
637
637
  }
638
638
  export type Webhooks = Record<string, WebhookHandlerDefinition>;
639
- export type { InstallHandlerContext, InstallHandlerResult, InstallHandler, } from './types';
639
+ export type { InstallHandlerContext, InstallHandlerResult, InstallHandler, ProvisionHandlerContext, ProvisionHandlerResult, ProvisionHandler, } from './types';
640
640
  /**
641
641
  * Install configuration - defines per-install env vars and lifecycle hooks.
642
642
  * Tool names reference tools in the tool registry, enabling agent-invocation.
@@ -665,8 +665,6 @@ export interface ProvisionConfig {
665
665
  navigation?: NavigationConfig;
666
666
  /** Page definitions for app UI */
667
667
  pages?: PageDefinition[];
668
- /** Tool name to invoke after executable is healthy during provisioning */
669
- onProvision?: string;
670
668
  }
671
669
  export interface SkedyulConfig {
672
670
  /** App name */
package/dist/index.d.ts CHANGED
@@ -11,4 +11,4 @@ declare const _default: {
11
11
  };
12
12
  export default _default;
13
13
  export { defineConfig, loadConfig, validateConfig, CONFIG_FILE_NAMES, getAllEnvKeys, getRequiredInstallEnvKeys, } from './config';
14
- export type { SkedyulConfig, SerializableSkedyulConfig, EnvVariableDefinition, EnvSchema, EnvVisibility, ComputeLayerType, InstallHandlerContext, InstallHandlerResult, InstallHandler, InstallConfig, ModelDefinition, ModelFieldDefinition, ResourceScope, FieldOwner, InternalFieldDataType, FieldOption, InlineFieldDefinition, AppFieldVisibility, RelationshipDefinition, RelationshipLink, RelationshipCardinality, OnDeleteBehavior, ChannelDefinition, ChannelCapability, ChannelCapabilityType, ChannelFieldDefinition, WorkflowDefinition, WorkflowAction, WorkflowActionInput, PageDefinition, PageBlockDefinition, PageFieldDefinition, PageActionDefinition, PageType, PageBlockType, PageFieldType, PageFieldSource, PageFormHeader, PageContextMode, PageContextItemDefinition, PageContextDefinition, PageInstanceFilter, NavigationItem, NavigationSection, NavigationSidebar, BreadcrumbItem, NavigationBreadcrumb, NavigationConfig, WebhookHttpMethod, WebhookRequest, WebhookHandlerContext, WebhookHandlerResponse, WebhookHandlerFn, WebhookHandlerDefinition, Webhooks, WebhookHandlerMetadata, ProvisionConfig, ModelDependency, ChannelDependency, WorkflowDependency, ResourceDependency, StructuredFilter, } from './config';
14
+ export type { SkedyulConfig, SerializableSkedyulConfig, EnvVariableDefinition, EnvSchema, EnvVisibility, ComputeLayerType, InstallHandlerContext, InstallHandlerResult, InstallHandler, ProvisionHandlerContext, ProvisionHandlerResult, ProvisionHandler, InstallConfig, ModelDefinition, ModelFieldDefinition, ResourceScope, FieldOwner, InternalFieldDataType, FieldOption, InlineFieldDefinition, AppFieldVisibility, RelationshipDefinition, RelationshipLink, RelationshipCardinality, OnDeleteBehavior, ChannelDefinition, ChannelCapability, ChannelCapabilityType, ChannelFieldDefinition, WorkflowDefinition, WorkflowAction, WorkflowActionInput, PageDefinition, PageBlockDefinition, PageFieldDefinition, PageActionDefinition, PageType, PageBlockType, PageFieldType, PageFieldSource, PageFormHeader, PageContextMode, PageContextItemDefinition, PageContextDefinition, PageInstanceFilter, NavigationItem, NavigationSection, NavigationSidebar, BreadcrumbItem, NavigationBreadcrumb, NavigationConfig, WebhookHttpMethod, WebhookRequest, WebhookHandlerContext, WebhookHandlerResponse, WebhookHandlerFn, WebhookHandlerDefinition, Webhooks, WebhookHandlerMetadata, ProvisionConfig, ModelDependency, ChannelDependency, WorkflowDependency, ResourceDependency, StructuredFilter, } from './config';
package/dist/schemas.d.ts CHANGED
@@ -3417,7 +3417,6 @@ export declare const ProvisionConfigSchema: z.ZodObject<{
3417
3417
  where: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
3418
3418
  }, z.core.$strip>>;
3419
3419
  }, z.core.$strip>>>;
3420
- onProvision: z.ZodOptional<z.ZodString>;
3421
3420
  }, z.core.$strip>;
3422
3421
  export declare const SkedyulConfigSchema: z.ZodObject<{
3423
3422
  name: z.ZodString;
@@ -4058,7 +4057,6 @@ export declare const SkedyulConfigSchema: z.ZodObject<{
4058
4057
  where: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
4059
4058
  }, z.core.$strip>>;
4060
4059
  }, z.core.$strip>>>;
4061
- onProvision: z.ZodOptional<z.ZodString>;
4062
4060
  }, z.core.$strip>, z.ZodUnknown]>>;
4063
4061
  }, z.core.$strip>;
4064
4062
  export type ParsedSkedyulConfig = z.infer<typeof SkedyulConfigSchema>;
package/dist/schemas.js CHANGED
@@ -677,8 +677,6 @@ exports.ProvisionConfigSchema = zod_1.z.object({
677
677
  /** Base navigation configuration for all pages (can be overridden per page) */
678
678
  navigation: exports.NavigationConfigSchema.optional(),
679
679
  pages: zod_1.z.array(exports.PageDefinitionSchema).optional(),
680
- /** Tool name to invoke after executable is healthy during provisioning */
681
- onProvision: zod_1.z.string().optional(),
682
680
  });
683
681
  // ─────────────────────────────────────────────────────────────────────────────
684
682
  // Main Config Schema
package/dist/server.js CHANGED
@@ -886,8 +886,15 @@ function createDedicatedServerInstance(config, tools, callTool, state, mcpServer
886
886
  appInstallationId: installBody.context.appInstallationId,
887
887
  app: installBody.context.app,
888
888
  };
889
+ // Build request-scoped config for SDK access
890
+ const installRequestConfig = {
891
+ baseUrl: process.env.SKEDYUL_API_URL ?? '',
892
+ apiToken: process.env.SKEDYUL_API_TOKEN ?? '',
893
+ };
889
894
  try {
890
- const result = await config.installHandler(installContext);
895
+ const result = await (0, client_1.runWithConfig)(installRequestConfig, async () => {
896
+ return await config.installHandler(installContext);
897
+ });
891
898
  sendJSON(res, 200, {
892
899
  env: result.env ?? {},
893
900
  redirect: result.redirect,
@@ -903,6 +910,55 @@ function createDedicatedServerInstance(config, tools, callTool, state, mcpServer
903
910
  }
904
911
  return;
905
912
  }
913
+ // Handle /provision endpoint for provision handlers
914
+ if (pathname === '/provision' && req.method === 'POST') {
915
+ if (!config.provisionHandler) {
916
+ sendJSON(res, 404, { error: 'Provision handler not configured' });
917
+ return;
918
+ }
919
+ let provisionBody;
920
+ try {
921
+ provisionBody = (await parseJSONBody(req));
922
+ }
923
+ catch {
924
+ sendJSON(res, 400, {
925
+ error: { code: -32700, message: 'Parse error' },
926
+ });
927
+ return;
928
+ }
929
+ if (!provisionBody.context?.app) {
930
+ sendJSON(res, 400, {
931
+ error: { code: -32602, message: 'Missing context (app required)' },
932
+ });
933
+ return;
934
+ }
935
+ const provisionContext = {
936
+ env: provisionBody.env ?? {},
937
+ app: provisionBody.context.app,
938
+ };
939
+ // Build request-scoped config for SDK access
940
+ // Use env from request body (passed during provisioning) with fallback to process.env
941
+ const requestEnv = provisionBody.env ?? {};
942
+ const provisionRequestConfig = {
943
+ baseUrl: requestEnv.SKEDYUL_API_URL ?? process.env.SKEDYUL_API_URL ?? '',
944
+ apiToken: requestEnv.SKEDYUL_API_TOKEN ?? process.env.SKEDYUL_API_TOKEN ?? '',
945
+ };
946
+ try {
947
+ const result = await (0, client_1.runWithConfig)(provisionRequestConfig, async () => {
948
+ return await config.provisionHandler(provisionContext);
949
+ });
950
+ sendJSON(res, 200, result);
951
+ }
952
+ catch (err) {
953
+ sendJSON(res, 500, {
954
+ error: {
955
+ code: -32603,
956
+ message: err instanceof Error ? err.message : String(err ?? ''),
957
+ },
958
+ });
959
+ }
960
+ return;
961
+ }
906
962
  if (pathname === '/core' && req.method === 'POST') {
907
963
  let coreBody;
908
964
  try {
package/dist/types.d.ts CHANGED
@@ -167,6 +167,8 @@ export interface SkedyulServerConfig {
167
167
  coreApi?: CoreApiConfig;
168
168
  /** Optional install handler for the /install endpoint */
169
169
  installHandler?: InstallHandler;
170
+ /** Optional provision handler for the /provision endpoint */
171
+ provisionHandler?: ProvisionHandler;
170
172
  }
171
173
  export interface InstallHandlerContext {
172
174
  env: Record<string, string>;
@@ -185,6 +187,16 @@ export interface InstallHandlerResult {
185
187
  redirect?: string;
186
188
  }
187
189
  export type InstallHandler = (ctx: InstallHandlerContext) => Promise<InstallHandlerResult>;
190
+ export interface ProvisionHandlerContext {
191
+ env: Record<string, string>;
192
+ app: {
193
+ id: string;
194
+ versionId: string;
195
+ };
196
+ }
197
+ export interface ProvisionHandlerResult {
198
+ }
199
+ export type ProvisionHandler = (ctx: ProvisionHandlerContext) => Promise<ProvisionHandlerResult>;
188
200
  export interface APIGatewayProxyEvent {
189
201
  body: string | null;
190
202
  headers: Record<string, string>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skedyul",
3
- "version": "0.2.131",
3
+ "version": "0.2.134",
4
4
  "description": "The Skedyul SDK for Node.js",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",