skedyul 0.1.34 → 0.1.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ 1768373827435
package/dist/config.d.ts CHANGED
@@ -23,11 +23,37 @@ export interface AppModelDefinition {
23
23
  /** Description of what this model represents */
24
24
  description?: string;
25
25
  }
26
+ /**
27
+ * Context passed to the install handler when a user installs the app.
28
+ */
29
+ export interface InstallHandlerContext {
30
+ /** Environment variables from preInstall.env filled by the user */
31
+ env: Record<string, string>;
32
+ /** Workplace information */
33
+ workplace: {
34
+ id: string;
35
+ subdomain: string;
36
+ };
37
+ }
38
+ /**
39
+ * Result returned by the install handler.
40
+ */
41
+ export interface InstallHandlerResult {
42
+ /** Additional environment variables to add to the installation */
43
+ env?: Record<string, string>;
44
+ /** Optional OAuth redirect URL - if provided, user is redirected before install completes */
45
+ redirect?: string;
46
+ }
47
+ /**
48
+ * Install handler function type.
49
+ */
50
+ export type InstallHandler = (ctx: InstallHandlerContext) => Promise<InstallHandlerResult>;
26
51
  export interface InstallConfig {
27
52
  /**
28
53
  * Per-install environment variables.
29
54
  * These are configured by the user when installing the app.
30
55
  * Values are stored per-installation and can differ between installs.
56
+ * @deprecated Use preInstall.env and postInstall.env instead
31
57
  */
32
58
  env?: EnvSchema;
33
59
  /**
@@ -35,6 +61,35 @@ export interface InstallConfig {
35
61
  * Users will map these to their CRM models during installation.
36
62
  */
37
63
  appModels?: AppModelDefinition[];
64
+ /**
65
+ * Install handler - called when user clicks install.
66
+ * Use dynamic import: handler: import('./src/install')
67
+ */
68
+ handler?: Promise<{
69
+ default: InstallHandler;
70
+ }>;
71
+ }
72
+ /**
73
+ * Pre-install configuration.
74
+ * Variables collected BEFORE the app is installed (e.g., API keys, credentials).
75
+ */
76
+ export interface PreInstallConfig {
77
+ /**
78
+ * Environment variables required before installation.
79
+ * User must provide these values during the install flow.
80
+ */
81
+ env?: EnvSchema;
82
+ }
83
+ /**
84
+ * Post-install configuration.
85
+ * Variables that can be configured AFTER the app is installed.
86
+ */
87
+ export interface PostInstallConfig {
88
+ /**
89
+ * Environment variables configurable after installation.
90
+ * These appear in the Settings page of the installed app.
91
+ */
92
+ env?: EnvSchema;
38
93
  }
39
94
  export interface AppFieldVisibility {
40
95
  /** Show in data/detail view */
@@ -228,8 +283,21 @@ export interface SkedyulConfig {
228
283
  /**
229
284
  * Install-time configuration.
230
285
  * Defines what users need to configure when installing the app.
286
+ * @deprecated Use preInstall and postInstall instead
231
287
  */
232
288
  install?: InstallConfig;
289
+ /**
290
+ * Pre-install configuration.
291
+ * Environment variables collected BEFORE the app is installed.
292
+ * User must provide these values (e.g., API keys) during the install flow.
293
+ */
294
+ preInstall?: PreInstallConfig;
295
+ /**
296
+ * Post-install configuration.
297
+ * Environment variables that can be configured AFTER the app is installed.
298
+ * These appear in the Settings page of the installed app.
299
+ */
300
+ postInstall?: PostInstallConfig;
233
301
  /**
234
302
  * Communication channels this app provides.
235
303
  * Defines how the app can send/receive messages.
@@ -288,8 +356,12 @@ export interface SerializableSkedyulConfig {
288
356
  workflowsPath?: string;
289
357
  /** Global/version-level environment variable schema */
290
358
  env?: EnvSchema;
291
- /** Install-time configuration */
359
+ /** Install-time configuration @deprecated Use preInstall and postInstall */
292
360
  install?: InstallConfig;
361
+ /** Pre-install configuration (env vars required before install) */
362
+ preInstall?: PreInstallConfig;
363
+ /** Post-install configuration (env vars configurable after install) */
364
+ postInstall?: PostInstallConfig;
293
365
  /** Communication channels this app provides */
294
366
  communicationChannels?: CommunicationChannelDefinition[];
295
367
  /** Workflows this app provides */
@@ -339,12 +411,19 @@ export declare function validateConfig(config: SkedyulConfig): {
339
411
  };
340
412
  /**
341
413
  * Get all required install env keys from a config
414
+ * @deprecated Use getRequiredPreInstallEnvKeys instead
342
415
  */
343
416
  export declare function getRequiredInstallEnvKeys(config: SkedyulConfig): string[];
417
+ /**
418
+ * Get all required pre-install env keys from a config
419
+ */
420
+ export declare function getRequiredPreInstallEnvKeys(config: SkedyulConfig): string[];
344
421
  /**
345
422
  * Get all env keys (both global and install) from a config
346
423
  */
347
424
  export declare function getAllEnvKeys(config: SkedyulConfig): {
348
425
  global: string[];
349
426
  install: string[];
427
+ preInstall: string[];
428
+ postInstall: string[];
350
429
  };
package/dist/config.js CHANGED
@@ -38,6 +38,7 @@ exports.defineConfig = defineConfig;
38
38
  exports.loadConfig = loadConfig;
39
39
  exports.validateConfig = validateConfig;
40
40
  exports.getRequiredInstallEnvKeys = getRequiredInstallEnvKeys;
41
+ exports.getRequiredPreInstallEnvKeys = getRequiredPreInstallEnvKeys;
41
42
  exports.getAllEnvKeys = getAllEnvKeys;
42
43
  const fs = __importStar(require("fs"));
43
44
  const path = __importStar(require("path"));
@@ -184,7 +185,7 @@ function validateConfig(config) {
184
185
  }
185
186
  }
186
187
  }
187
- // Validate install.env schema
188
+ // Validate install.env schema (deprecated)
188
189
  if (config.install?.env) {
189
190
  for (const [key, def] of Object.entries(config.install.env)) {
190
191
  if (!def.label) {
@@ -195,6 +196,28 @@ function validateConfig(config) {
195
196
  }
196
197
  }
197
198
  }
199
+ // Validate preInstall.env schema
200
+ if (config.preInstall?.env) {
201
+ for (const [key, def] of Object.entries(config.preInstall.env)) {
202
+ if (!def.label) {
203
+ errors.push(`preInstall.env.${key}: Missing required field 'label'`);
204
+ }
205
+ if (def.visibility && !['visible', 'encrypted'].includes(def.visibility)) {
206
+ errors.push(`preInstall.env.${key}: Invalid visibility '${def.visibility}'`);
207
+ }
208
+ }
209
+ }
210
+ // Validate postInstall.env schema
211
+ if (config.postInstall?.env) {
212
+ for (const [key, def] of Object.entries(config.postInstall.env)) {
213
+ if (!def.label) {
214
+ errors.push(`postInstall.env.${key}: Missing required field 'label'`);
215
+ }
216
+ if (def.visibility && !['visible', 'encrypted'].includes(def.visibility)) {
217
+ errors.push(`postInstall.env.${key}: Invalid visibility '${def.visibility}'`);
218
+ }
219
+ }
220
+ }
198
221
  // Validate appModels
199
222
  if (config.install?.appModels) {
200
223
  for (let i = 0; i < config.install.appModels.length; i++) {
@@ -293,6 +316,7 @@ function validateConfig(config) {
293
316
  }
294
317
  /**
295
318
  * Get all required install env keys from a config
319
+ * @deprecated Use getRequiredPreInstallEnvKeys instead
296
320
  */
297
321
  function getRequiredInstallEnvKeys(config) {
298
322
  if (!config.install?.env)
@@ -301,6 +325,16 @@ function getRequiredInstallEnvKeys(config) {
301
325
  .filter(([, def]) => def.required)
302
326
  .map(([key]) => key);
303
327
  }
328
+ /**
329
+ * Get all required pre-install env keys from a config
330
+ */
331
+ function getRequiredPreInstallEnvKeys(config) {
332
+ if (!config.preInstall?.env)
333
+ return [];
334
+ return Object.entries(config.preInstall.env)
335
+ .filter(([, def]) => def.required)
336
+ .map(([key]) => key);
337
+ }
304
338
  /**
305
339
  * Get all env keys (both global and install) from a config
306
340
  */
@@ -308,5 +342,7 @@ function getAllEnvKeys(config) {
308
342
  return {
309
343
  global: config.env ? Object.keys(config.env) : [],
310
344
  install: config.install?.env ? Object.keys(config.install.env) : [],
345
+ preInstall: config.preInstall?.env ? Object.keys(config.preInstall.env) : [],
346
+ postInstall: config.postInstall?.env ? Object.keys(config.postInstall.env) : [],
311
347
  };
312
348
  }
package/dist/index.d.ts CHANGED
@@ -3,4 +3,4 @@ export * from './schemas';
3
3
  export { server } from './server';
4
4
  export { workplace, communicationChannel, configure, getConfig } from './core/client';
5
5
  export { defineConfig, loadConfig, validateConfig, getRequiredInstallEnvKeys, getAllEnvKeys, CONFIG_FILE_NAMES, } from './config';
6
- export type { SkedyulConfig, SerializableSkedyulConfig, EnvVariableDefinition, EnvSchema, EnvVisibility, InstallConfig, AppModelDefinition, ComputeLayerType, AppFieldVisibility, AppFieldDefinition, ChannelToolBindings, ChannelIdentifierType, ChannelIdentifierValue, CommunicationChannelDefinition, WorkflowActionInput, WorkflowAction, WorkflowDefinition, } from './config';
6
+ export type { SkedyulConfig, SerializableSkedyulConfig, EnvVariableDefinition, EnvSchema, EnvVisibility, InstallConfig, AppModelDefinition, ComputeLayerType, InstallHandlerContext, InstallHandlerResult, InstallHandler, PreInstallConfig, PostInstallConfig, AppFieldVisibility, AppFieldDefinition, ChannelToolBindings, ChannelIdentifierType, ChannelIdentifierValue, CommunicationChannelDefinition, WorkflowActionInput, WorkflowAction, WorkflowDefinition, } from './config';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skedyul",
3
- "version": "0.1.34",
3
+ "version": "0.1.37",
4
4
  "description": "The Skedyul SDK for Node.js",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -13,12 +13,21 @@
13
13
  "default": "./dist/index.js"
14
14
  }
15
15
  },
16
- "files": ["dist"],
16
+ "files": [
17
+ "dist"
18
+ ],
17
19
  "scripts": {
18
- "build": "tsc --build tsconfig.json && tsc --project tsconfig.tests.json",
20
+ "build": "tsc --build tsconfig.json && tsc --project tsconfig.tests.json && node -e \"require('fs').mkdirSync('dist',{recursive:true}); require('fs').writeFileSync('dist/.build-stamp', String(Date.now()))\"",
21
+ "dev": "npx nodemon --watch src --ext js,ts --exec \"pnpm run build\"",
19
22
  "test": "npm run build && node --test dist-tests/server.test.js"
20
23
  },
21
- "keywords": ["mcp", "skedyul", "serverless", "node", "typescript"],
24
+ "keywords": [
25
+ "mcp",
26
+ "skedyul",
27
+ "serverless",
28
+ "node",
29
+ "typescript"
30
+ ],
22
31
  "repository": {
23
32
  "type": "git",
24
33
  "url": "https://github.com/skedyul/skedyul-node"
@@ -34,4 +43,4 @@
34
43
  "@types/node": "^24.10.1",
35
44
  "typescript": "^5.5.0"
36
45
  }
37
- }
46
+ }