skedyul 1.7.12 → 1.7.15

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
- 1786072268866
1
+ 1786107275036
package/dist/cli/index.js CHANGED
@@ -1151,6 +1151,12 @@ function parseEnvFieldsFromBlock(envBlock) {
1151
1151
  if (descMatch) field.description = descMatch[1];
1152
1152
  const scopeMatch = varContent.match(/scope\s*:\s*['"`](provision|install)['"`]/);
1153
1153
  if (scopeMatch) field.scope = scopeMatch[1];
1154
+ const installPhaseMatch = varContent.match(
1155
+ /installPhase\s*:\s*['"`](pre_install|post_install)['"`]/
1156
+ );
1157
+ if (installPhaseMatch) {
1158
+ field.installPhase = installPhaseMatch[1];
1159
+ }
1154
1160
  envVars[varName] = field;
1155
1161
  }
1156
1162
  return envVars;
@@ -1258,11 +1264,25 @@ function buildInstallEnvForSync(legacyInstall, provisionConfig) {
1258
1264
  }
1259
1265
  }
1260
1266
  }
1261
- return Object.keys(installEnv).length > 0 ? installEnv : void 0;
1267
+ if (Object.keys(installEnv).length === 0) {
1268
+ return void 0;
1269
+ }
1270
+ const pre = {};
1271
+ const post = {};
1272
+ for (const [key, def] of Object.entries(installEnv)) {
1273
+ if (def.installPhase === "post_install") {
1274
+ post[key] = def;
1275
+ } else {
1276
+ pre[key] = def;
1277
+ }
1278
+ }
1279
+ return { pre, post };
1262
1280
  }
1263
1281
  function filterEnvForInstallWorkflow(env, installConfig) {
1264
1282
  const installKeys = new Set(
1265
- Object.entries(installConfig?.env ?? {}).filter(([, def]) => def.scope === "install").map(([key]) => key)
1283
+ Object.entries(installConfig?.env ?? {}).filter(
1284
+ ([, def]) => def.scope === "install" && def.installPhase !== "post_install"
1285
+ ).map(([key]) => key)
1266
1286
  );
1267
1287
  if (installKeys.size === 0) {
1268
1288
  return {};
@@ -1321,7 +1341,7 @@ async function buildExecutableSyncConfig(registry, inputSchemaToJson, projectDir
1321
1341
  env: buildProvisionEnvFromInstallConfig(legacyInstallConfig.env)
1322
1342
  };
1323
1343
  }
1324
- const installEnv = buildInstallEnvForSync(legacyInstallConfig, provisionConfig ?? null);
1344
+ const installEnvSplit = buildInstallEnvForSync(legacyInstallConfig, provisionConfig ?? null);
1325
1345
  return {
1326
1346
  name: appConfig?.name,
1327
1347
  handle: appConfig?.handle,
@@ -1329,7 +1349,8 @@ async function buildExecutableSyncConfig(registry, inputSchemaToJson, projectDir
1329
1349
  tools,
1330
1350
  ...webhooks.length > 0 ? { webhooks } : {},
1331
1351
  ...provision ? { provision } : {},
1332
- ...installEnv ? { install: { env: installEnv } } : {},
1352
+ ...installEnvSplit && Object.keys(installEnvSplit.pre).length > 0 ? { install: { env: installEnvSplit.pre } } : {},
1353
+ ...installEnvSplit && Object.keys(installEnvSplit.post).length > 0 ? { installPost: { env: installEnvSplit.post } } : {},
1333
1354
  syncedAt: (/* @__PURE__ */ new Date()).toISOString()
1334
1355
  };
1335
1356
  }
@@ -23,6 +23,7 @@ export interface InstallEnvField {
23
23
  placeholder?: string;
24
24
  description?: string;
25
25
  scope?: 'provision' | 'install';
26
+ installPhase?: 'pre_install' | 'post_install';
26
27
  }
27
28
  export interface InstallConfigData {
28
29
  env?: Record<string, InstallEnvField>;
@@ -45,7 +46,7 @@ export declare function loadInstallHandler(projectDir?: string): Promise<((ctx:
45
46
  export declare function filterInstallScopedEnv(env: Record<string, InstallEnvField & {
46
47
  scope?: string;
47
48
  }>): Record<string, InstallEnvField>;
48
- /** Env vars passed to the install workflow (install-scoped only). */
49
+ /** Env vars passed to the install workflow (pre_install install-scoped only). */
49
50
  export declare function filterEnvForInstallWorkflow(env: Record<string, string>, installConfig: InstallConfigData | null): Record<string, string>;
50
51
  /**
51
52
  * Load provision config (env, models, pages) directly from src/provision/index.ts.
@@ -0,0 +1,13 @@
1
+ import type { EnvSchema, EnvVariable, InstallPhase } from './types/env';
2
+ export type { InstallPhase };
3
+ /** Default install collection phase when omitted on install-scoped vars. */
4
+ export declare const DEFAULT_INSTALL_PHASE: InstallPhase;
5
+ export declare function resolveInstallPhase(def: Pick<EnvVariable, 'scope' | 'installPhase' | 'required'>): InstallPhase | null;
6
+ export declare function isPreInstallEnvVar(def: Pick<EnvVariable, 'scope' | 'installPhase' | 'required'>): boolean;
7
+ export declare function isPostInstallEnvVar(def: Pick<EnvVariable, 'scope' | 'installPhase' | 'required'>): boolean;
8
+ export declare function filterEnvSchemaByInstallPhase(env: EnvSchema | undefined, phase: InstallPhase): EnvSchema;
9
+ export declare function splitProvisionEnvSchema(env: EnvSchema | undefined): {
10
+ global: EnvSchema;
11
+ preInstall: EnvSchema;
12
+ postInstall: EnvSchema;
13
+ };
@@ -15,3 +15,4 @@ export { defineModel, defineEntity, defineChannel, definePage, defineWorkflow, d
15
15
  export { SCHEMA_FILE_EXTENSIONS, loadSchema, saveSchema, serializeSchemaToJson, serializeSchemaToTypeScript, transformToBackendSchema, transformFromBackendSchema, type LoadSchemaOptions, type LoadSchemaResult, type SerializeSchemaOptions, type BackendModelDefinition, type BackendFieldDefinition, type BackendRelationshipDefinition, type BackendDesiredSchema, } from './schema-loader';
16
16
  export { loadAndResolveConfig, serializeResolvedConfig, type ResolvedConfig } from './resolver';
17
17
  export { getAllEnvKeys, getRequiredInstallEnvKeys } from './utils';
18
+ export { DEFAULT_INSTALL_PHASE, resolveInstallPhase, isPreInstallEnvVar, isPostInstallEnvVar, filterEnvSchemaByInstallPhase, splitProvisionEnvSchema, type InstallPhase, } from './env-phase';
@@ -12,6 +12,12 @@ import type { Visibility } from './base';
12
12
  * - 'install': User-configured during app installation
13
13
  */
14
14
  export type EnvScope = 'provision' | 'install';
15
+ /**
16
+ * When an install-scoped variable is collected from the user vs set by the app/platform.
17
+ * - 'pre_install': user fills on the install page before Install is clicked
18
+ * - 'post_install': set by OAuth callback, install handler, or runtime (never on pre-install form)
19
+ */
20
+ export type InstallPhase = 'pre_install' | 'post_install';
15
21
  /**
16
22
  * Environment variable definition.
17
23
  */
@@ -20,6 +26,8 @@ export interface EnvVariable {
20
26
  label: string;
21
27
  /** Scope: 'provision' (developer) or 'install' (user) */
22
28
  scope?: EnvScope;
29
+ /** When to collect install-scoped vars (default: 'pre_install') */
30
+ installPhase?: InstallPhase;
23
31
  /** Whether this variable is required */
24
32
  required?: boolean;
25
33
  /** Visibility setting: 'visible' or 'encrypted' */
@@ -1168,8 +1168,11 @@ var AgentYAMLV3Schema = z7.object({
1168
1168
 
1169
1169
  // src/schemas.ts
1170
1170
  var EnvVisibilitySchema = z8.enum(["visible", "encrypted"]);
1171
+ var InstallPhaseSchema = z8.enum(["pre_install", "post_install"]);
1171
1172
  var EnvVariableDefinitionSchema = z8.object({
1172
1173
  label: z8.string(),
1174
+ scope: z8.enum(["provision", "install"]).optional(),
1175
+ installPhase: InstallPhaseSchema.optional(),
1173
1176
  required: z8.boolean().optional(),
1174
1177
  visibility: EnvVisibilitySchema.optional(),
1175
1178
  default: z8.string().optional(),
@@ -6297,6 +6300,55 @@ import * as os from "os";
6297
6300
  import * as fs5 from "fs";
6298
6301
  import * as path5 from "path";
6299
6302
 
6303
+ // src/config/env-phase.ts
6304
+ var DEFAULT_INSTALL_PHASE = "pre_install";
6305
+ function resolveInstallPhase(def) {
6306
+ if (def.scope === "provision") {
6307
+ return null;
6308
+ }
6309
+ if (def.installPhase === "post_install" || def.installPhase === "pre_install") {
6310
+ return def.installPhase;
6311
+ }
6312
+ if (def.scope === "install") {
6313
+ return def.required ? "pre_install" : "post_install";
6314
+ }
6315
+ return DEFAULT_INSTALL_PHASE;
6316
+ }
6317
+ function isPreInstallEnvVar(def) {
6318
+ return resolveInstallPhase(def) === "pre_install";
6319
+ }
6320
+ function isPostInstallEnvVar(def) {
6321
+ return resolveInstallPhase(def) === "post_install";
6322
+ }
6323
+ function filterEnvSchemaByInstallPhase(env, phase) {
6324
+ if (!env) {
6325
+ return {};
6326
+ }
6327
+ return Object.fromEntries(
6328
+ Object.entries(env).filter(([, def]) => resolveInstallPhase(def) === phase)
6329
+ );
6330
+ }
6331
+ function splitProvisionEnvSchema(env) {
6332
+ const global = {};
6333
+ const preInstall = {};
6334
+ const postInstall = {};
6335
+ if (!env) {
6336
+ return { global, preInstall, postInstall };
6337
+ }
6338
+ for (const [key, def] of Object.entries(env)) {
6339
+ if (def.scope === "install") {
6340
+ if (isPostInstallEnvVar(def)) {
6341
+ postInstall[key] = def;
6342
+ } else {
6343
+ preInstall[key] = def;
6344
+ }
6345
+ continue;
6346
+ }
6347
+ global[key] = def;
6348
+ }
6349
+ return { global, preInstall, postInstall };
6350
+ }
6351
+
6300
6352
  // src/config/utils.ts
6301
6353
  function getAllEnvKeys(config) {
6302
6354
  const provision = config.provision && "env" in config.provision ? config.provision : void 0;
@@ -6309,7 +6361,7 @@ function getAllEnvKeys(config) {
6309
6361
  function getRequiredInstallEnvKeys(config) {
6310
6362
  const provision = config.provision && "env" in config.provision ? config.provision : void 0;
6311
6363
  if (!provision?.env) return [];
6312
- return Object.entries(provision.env).filter(([, def]) => def.required).map(([key]) => key);
6364
+ return Object.entries(provision.env).filter(([, def]) => def.scope === "install" && isPreInstallEnvVar(def) && def.required).map(([key]) => key);
6313
6365
  }
6314
6366
 
6315
6367
  // src/ratelimit/resolve-queue-key.ts
@@ -8773,6 +8825,7 @@ export {
8773
8825
  CustomEventPayloadSchema,
8774
8826
  CustomEventTypeSchema,
8775
8827
  DEFAULT_DOCKERFILE,
8828
+ DEFAULT_INSTALL_PHASE,
8776
8829
  DatePickerComponentDefinitionSchema,
8777
8830
  DayOfWeekSchema,
8778
8831
  EmptyFormComponentDefinitionSchema,
@@ -8814,6 +8867,7 @@ export {
8814
8867
  InputMappingSchema,
8815
8868
  InstallConfigSchema,
8816
8869
  InstallError,
8870
+ InstallPhaseSchema,
8817
8871
  InvalidConfigurationError,
8818
8872
  LegacyFormBlockDefinitionSchema,
8819
8873
  ListBlockDefinitionSchema,
@@ -9007,6 +9061,7 @@ export {
9007
9061
  evaluateTemplate,
9008
9062
  event,
9009
9063
  file,
9064
+ filterEnvSchemaByInstallPhase,
9010
9065
  formatContextForPrompt,
9011
9066
  formatMoneyMinorEstimate,
9012
9067
  formatMoneyMinorRange,
@@ -9027,6 +9082,8 @@ export {
9027
9082
  isDeveloperContext,
9028
9083
  isFailure,
9029
9084
  isModelDependency,
9085
+ isPostInstallEnvVar,
9086
+ isPreInstallEnvVar,
9030
9087
  isProvisionContext,
9031
9088
  isRetryable,
9032
9089
  isRuntimeContext,
@@ -9048,6 +9105,7 @@ export {
9048
9105
  requeue,
9049
9106
  resetSequencerBackendForTests,
9050
9107
  resolveInputMappings,
9108
+ resolveInstallPhase,
9051
9109
  resolveQueue,
9052
9110
  resolveSequencer,
9053
9111
  resource,
@@ -9061,6 +9119,7 @@ export {
9061
9119
  release as sequencerRelease,
9062
9120
  server,
9063
9121
  setup,
9122
+ splitProvisionEnvSchema,
9064
9123
  toGsm7,
9065
9124
  token,
9066
9125
  validateCRMSchema,
package/dist/index.d.ts CHANGED
@@ -16,7 +16,7 @@ declare const _default: {
16
16
  z: typeof z;
17
17
  };
18
18
  export default _default;
19
- export { defineConfig, defineModel, defineEntity, defineChannel, definePage, defineWorkflow, defineAgent, defineEnv, defineNavigation, defineSetupStep, defineBatchOperation, getAllEnvKeys, getRequiredInstallEnvKeys, } from './config';
19
+ export { defineConfig, defineModel, defineEntity, defineChannel, definePage, defineWorkflow, defineAgent, defineEnv, defineNavigation, defineSetupStep, defineBatchOperation, getAllEnvKeys, getRequiredInstallEnvKeys, DEFAULT_INSTALL_PHASE, resolveInstallPhase, isPreInstallEnvVar, isPostInstallEnvVar, filterEnvSchemaByInstallPhase, splitProvisionEnvSchema, } from './config';
20
20
  export { queuedFetch, requeue, resolveQueue, createQueueHandle, queuedFetchResponse, registerQueueConfig, runWithRateLimitExecutionContext, getRateLimitExecutionContext, defaultShouldRetry, QueueContextError, QueueNotFoundError, QueuedFetchExhaustedError, RequeueOutsideContextError, RateLimitBackendError, RateLimitExceededError, } from './ratelimit';
21
21
  export type { QueueInput, QueueSelector, Lease, QueueLimits, ResolvedQueue, RateLimitExecutionContext, RateLimitBackend, QueueScope, QueueConfig, SerializableQueueConfig, QueueRegistry, } from './ratelimit';
22
22
  export { sequencer, allow as sequencerAllow, acquire as sequencerAcquire, release as sequencerRelease, resolveSequencer, createSequencerHandle, registerSequencerConfig, clearRegisteredSequencerConfig, getSequencerConfig, getSequencerDefinitions, resetSequencerBackendForTests, memorySequencerBackend, platformSequencerBackend, SequencerContextError, SequencerNotFoundError, SequencerBackendError, SequencerLockError, } from './sequencer';
@@ -35,7 +35,7 @@ export type { CRMContext, SenderContext, ThreadContextItem, ThreadInfo, SandboxC
35
35
  export { MemoryEntryTypeSchema, MemoryEntrySchema, WorkingMemoryConfigSchema, SemanticMemoryConfigSchema, ExternalMemoryConfigSchema, MemoryConfigSchema, MemoryScopeSchema, MemoryQueryOptionsSchema, ConversationSummarySchema, AgentObservationSchema, ExternalDataCacheSchema, MemoryService, InMemoryStore, createInMemoryService, } from './memory';
36
36
  export type { MemoryEntryType, MemoryEntry, WorkingMemoryConfig as MemoryWorkingConfig, SemanticMemoryConfig as MemorySemanticConfig, ExternalMemoryConfig as MemoryExternalConfig, MemoryConfig, MemoryScope, MemoryQueryOptions, ConversationSummary, AgentObservation, ExternalDataCache, MemoryStore, } from './memory';
37
37
  export type { CRMFieldType, CRMFieldRequirement, CRMFieldOption, CRMFieldDefinition, CRMFieldSchema, CRMModelSchema, CRMCardinality, CRMOnDelete, CRMRelationshipLink, CRMRelationshipSchema, CRMSchema, CRMSchemaValidationResult, } from './schemas';
38
- export type { SkedyulConfig, SerializableSkedyulConfig, InstallConfig, ProvisionConfig, BaseDefinition, Scope, FieldOwner, Visibility, ComputeLayer, StructuredFilter, FilterOperator, FilterCondition, FieldOption, EnvVariable, EnvSchema, FieldType, Cardinality, OnDelete, InlineFieldDefinition, FieldVisibility, FieldDefinition, ModelDefinition, RelationshipLink, RelationshipDefinition, CapabilityType, ChannelCapability, ChannelBatchCapability, ChannelFieldPermissions, ChannelField, ChannelDefinition, WorkflowActionInput, WorkflowAction, WorkflowDefinition, AgentDefinition, NavigationItem, NavigationSection, NavigationSidebar, BreadcrumbItem, NavigationBreadcrumb, NavigationConfig, ContextMode, ContextItemModel, ContextItemTool, ContextItem, ContextDefinition, FormStyleProps, ButtonVariant, ButtonSize, ButtonProps, RelationshipExtension, FormHeader, FormActionDefinition, ActionDefinition, ModalFormDefinition, InputComponent, TextareaComponent, SelectComponent, ComboboxComponent, CheckboxComponent, DatePickerComponent, TimePickerComponent, StatusIndicator, FieldSettingComponent, ImageSettingComponent, FileSettingComponent, ListItemTemplate, ListComponent, EmptyFormComponent, AlertComponent, FormComponent, FormLayoutColumn, FormLayoutRow, FormLayoutConfig, FormProps, CardHeader, CardBlock, ListBlock, BlockDefinition, SetupStepDefinition, SetupStepKind, BatchCascadePhase, BatchOperationDefinition, BatchOperationContext, BatchOperationIterateResult, BatchOperationSetupResult, PageType, PageDefinition, HttpMethod, WebhookRequest, WebhookHandlerContext, WebhookHandlerResponse, WebhookHandlerFn, WebhookHandlerDefinition, Webhooks, WebhookHandlerMetadata, ModelDependency, ChannelDependency, WorkflowDependency, ResourceDependency, } from './config';
38
+ export type { SkedyulConfig, SerializableSkedyulConfig, InstallConfig, ProvisionConfig, BaseDefinition, Scope, FieldOwner, Visibility, ComputeLayer, StructuredFilter, FilterOperator, FilterCondition, FieldOption, EnvVariable, EnvSchema, InstallPhase, FieldType, Cardinality, OnDelete, InlineFieldDefinition, FieldVisibility, FieldDefinition, ModelDefinition, RelationshipLink, RelationshipDefinition, CapabilityType, ChannelCapability, ChannelBatchCapability, ChannelFieldPermissions, ChannelField, ChannelDefinition, WorkflowActionInput, WorkflowAction, WorkflowDefinition, AgentDefinition, NavigationItem, NavigationSection, NavigationSidebar, BreadcrumbItem, NavigationBreadcrumb, NavigationConfig, ContextMode, ContextItemModel, ContextItemTool, ContextItem, ContextDefinition, FormStyleProps, ButtonVariant, ButtonSize, ButtonProps, RelationshipExtension, FormHeader, FormActionDefinition, ActionDefinition, ModalFormDefinition, InputComponent, TextareaComponent, SelectComponent, ComboboxComponent, CheckboxComponent, DatePickerComponent, TimePickerComponent, StatusIndicator, FieldSettingComponent, ImageSettingComponent, FileSettingComponent, ListItemTemplate, ListComponent, EmptyFormComponent, AlertComponent, FormComponent, FormLayoutColumn, FormLayoutRow, FormLayoutConfig, FormProps, CardHeader, CardBlock, ListBlock, BlockDefinition, SetupStepDefinition, SetupStepKind, BatchCascadePhase, BatchOperationDefinition, BatchOperationContext, BatchOperationIterateResult, BatchOperationSetupResult, PageType, PageDefinition, HttpMethod, WebhookRequest, WebhookHandlerContext, WebhookHandlerResponse, WebhookHandlerFn, WebhookHandlerDefinition, Webhooks, WebhookHandlerMetadata, ModelDependency, ChannelDependency, WorkflowDependency, ResourceDependency, } from './config';
39
39
  export { compileAgent, compileWorkflow } from './compiler';
40
40
  export type { ValidationError, ValidationWarning, ResolvedPersona, ResolvedTool, EventConfig as CompilerEventConfig, IRMemoryConfig, PolicyConfig, IRRuntimeConfig, AgentIR, WorkflowStepIR, WorkflowIR, CompilationResult, } from './compiler';
41
41
  export { TimeStampSchema, DayOfWeekSchema, TimeWindowSlotSchema, WaitUnitSchema, WaitInputRelativeSchema, WaitInputAbsoluteSchema, WaitInputSchema, } from './scheduling/types';
package/dist/index.js CHANGED
@@ -84,6 +84,7 @@ __export(index_exports, {
84
84
  CustomEventPayloadSchema: () => CustomEventPayloadSchema,
85
85
  CustomEventTypeSchema: () => CustomEventTypeSchema,
86
86
  DEFAULT_DOCKERFILE: () => DEFAULT_DOCKERFILE,
87
+ DEFAULT_INSTALL_PHASE: () => DEFAULT_INSTALL_PHASE,
87
88
  DatePickerComponentDefinitionSchema: () => DatePickerComponentDefinitionSchema,
88
89
  DayOfWeekSchema: () => DayOfWeekSchema,
89
90
  EmptyFormComponentDefinitionSchema: () => EmptyFormComponentDefinitionSchema,
@@ -125,6 +126,7 @@ __export(index_exports, {
125
126
  InputMappingSchema: () => InputMappingSchema,
126
127
  InstallConfigSchema: () => InstallConfigSchema,
127
128
  InstallError: () => InstallError,
129
+ InstallPhaseSchema: () => InstallPhaseSchema,
128
130
  InvalidConfigurationError: () => InvalidConfigurationError,
129
131
  LegacyFormBlockDefinitionSchema: () => LegacyFormBlockDefinitionSchema,
130
132
  ListBlockDefinitionSchema: () => ListBlockDefinitionSchema,
@@ -318,6 +320,7 @@ __export(index_exports, {
318
320
  evaluateTemplate: () => evaluateTemplate,
319
321
  event: () => event,
320
322
  file: () => file,
323
+ filterEnvSchemaByInstallPhase: () => filterEnvSchemaByInstallPhase,
321
324
  formatContextForPrompt: () => formatContextForPrompt,
322
325
  formatMoneyMinorEstimate: () => formatMoneyMinorEstimate,
323
326
  formatMoneyMinorRange: () => formatMoneyMinorRange,
@@ -338,6 +341,8 @@ __export(index_exports, {
338
341
  isDeveloperContext: () => isDeveloperContext,
339
342
  isFailure: () => isFailure,
340
343
  isModelDependency: () => isModelDependency,
344
+ isPostInstallEnvVar: () => isPostInstallEnvVar,
345
+ isPreInstallEnvVar: () => isPreInstallEnvVar,
341
346
  isProvisionContext: () => isProvisionContext,
342
347
  isRetryable: () => isRetryable,
343
348
  isRuntimeContext: () => isRuntimeContext,
@@ -359,6 +364,7 @@ __export(index_exports, {
359
364
  requeue: () => requeue,
360
365
  resetSequencerBackendForTests: () => resetSequencerBackendForTests,
361
366
  resolveInputMappings: () => resolveInputMappings,
367
+ resolveInstallPhase: () => resolveInstallPhase,
362
368
  resolveQueue: () => resolveQueue,
363
369
  resolveSequencer: () => resolveSequencer,
364
370
  resource: () => resource,
@@ -372,6 +378,7 @@ __export(index_exports, {
372
378
  sequencerRelease: () => release,
373
379
  server: () => server,
374
380
  setup: () => setup,
381
+ splitProvisionEnvSchema: () => splitProvisionEnvSchema,
375
382
  toGsm7: () => toGsm7,
376
383
  token: () => token,
377
384
  validateCRMSchema: () => validateCRMSchema,
@@ -1549,8 +1556,11 @@ var AgentYAMLV3Schema = import_v47.z.object({
1549
1556
 
1550
1557
  // src/schemas.ts
1551
1558
  var EnvVisibilitySchema = import_v48.z.enum(["visible", "encrypted"]);
1559
+ var InstallPhaseSchema = import_v48.z.enum(["pre_install", "post_install"]);
1552
1560
  var EnvVariableDefinitionSchema = import_v48.z.object({
1553
1561
  label: import_v48.z.string(),
1562
+ scope: import_v48.z.enum(["provision", "install"]).optional(),
1563
+ installPhase: InstallPhaseSchema.optional(),
1554
1564
  required: import_v48.z.boolean().optional(),
1555
1565
  visibility: EnvVisibilitySchema.optional(),
1556
1566
  default: import_v48.z.string().optional(),
@@ -6678,6 +6688,55 @@ var os = __toESM(require("os"));
6678
6688
  var fs5 = __toESM(require("fs"));
6679
6689
  var path5 = __toESM(require("path"));
6680
6690
 
6691
+ // src/config/env-phase.ts
6692
+ var DEFAULT_INSTALL_PHASE = "pre_install";
6693
+ function resolveInstallPhase(def) {
6694
+ if (def.scope === "provision") {
6695
+ return null;
6696
+ }
6697
+ if (def.installPhase === "post_install" || def.installPhase === "pre_install") {
6698
+ return def.installPhase;
6699
+ }
6700
+ if (def.scope === "install") {
6701
+ return def.required ? "pre_install" : "post_install";
6702
+ }
6703
+ return DEFAULT_INSTALL_PHASE;
6704
+ }
6705
+ function isPreInstallEnvVar(def) {
6706
+ return resolveInstallPhase(def) === "pre_install";
6707
+ }
6708
+ function isPostInstallEnvVar(def) {
6709
+ return resolveInstallPhase(def) === "post_install";
6710
+ }
6711
+ function filterEnvSchemaByInstallPhase(env, phase) {
6712
+ if (!env) {
6713
+ return {};
6714
+ }
6715
+ return Object.fromEntries(
6716
+ Object.entries(env).filter(([, def]) => resolveInstallPhase(def) === phase)
6717
+ );
6718
+ }
6719
+ function splitProvisionEnvSchema(env) {
6720
+ const global = {};
6721
+ const preInstall = {};
6722
+ const postInstall = {};
6723
+ if (!env) {
6724
+ return { global, preInstall, postInstall };
6725
+ }
6726
+ for (const [key, def] of Object.entries(env)) {
6727
+ if (def.scope === "install") {
6728
+ if (isPostInstallEnvVar(def)) {
6729
+ postInstall[key] = def;
6730
+ } else {
6731
+ preInstall[key] = def;
6732
+ }
6733
+ continue;
6734
+ }
6735
+ global[key] = def;
6736
+ }
6737
+ return { global, preInstall, postInstall };
6738
+ }
6739
+
6681
6740
  // src/config/utils.ts
6682
6741
  function getAllEnvKeys(config) {
6683
6742
  const provision = config.provision && "env" in config.provision ? config.provision : void 0;
@@ -6690,7 +6749,7 @@ function getAllEnvKeys(config) {
6690
6749
  function getRequiredInstallEnvKeys(config) {
6691
6750
  const provision = config.provision && "env" in config.provision ? config.provision : void 0;
6692
6751
  if (!provision?.env) return [];
6693
- return Object.entries(provision.env).filter(([, def]) => def.required).map(([key]) => key);
6752
+ return Object.entries(provision.env).filter(([, def]) => def.scope === "install" && isPreInstallEnvVar(def) && def.required).map(([key]) => key);
6694
6753
  }
6695
6754
 
6696
6755
  // src/ratelimit/resolve-queue-key.ts
@@ -9155,6 +9214,7 @@ var index_default = { z: import_v414.z };
9155
9214
  CustomEventPayloadSchema,
9156
9215
  CustomEventTypeSchema,
9157
9216
  DEFAULT_DOCKERFILE,
9217
+ DEFAULT_INSTALL_PHASE,
9158
9218
  DatePickerComponentDefinitionSchema,
9159
9219
  DayOfWeekSchema,
9160
9220
  EmptyFormComponentDefinitionSchema,
@@ -9196,6 +9256,7 @@ var index_default = { z: import_v414.z };
9196
9256
  InputMappingSchema,
9197
9257
  InstallConfigSchema,
9198
9258
  InstallError,
9259
+ InstallPhaseSchema,
9199
9260
  InvalidConfigurationError,
9200
9261
  LegacyFormBlockDefinitionSchema,
9201
9262
  ListBlockDefinitionSchema,
@@ -9388,6 +9449,7 @@ var index_default = { z: import_v414.z };
9388
9449
  evaluateTemplate,
9389
9450
  event,
9390
9451
  file,
9452
+ filterEnvSchemaByInstallPhase,
9391
9453
  formatContextForPrompt,
9392
9454
  formatMoneyMinorEstimate,
9393
9455
  formatMoneyMinorRange,
@@ -9408,6 +9470,8 @@ var index_default = { z: import_v414.z };
9408
9470
  isDeveloperContext,
9409
9471
  isFailure,
9410
9472
  isModelDependency,
9473
+ isPostInstallEnvVar,
9474
+ isPreInstallEnvVar,
9411
9475
  isProvisionContext,
9412
9476
  isRetryable,
9413
9477
  isRuntimeContext,
@@ -9429,6 +9493,7 @@ var index_default = { z: import_v414.z };
9429
9493
  requeue,
9430
9494
  resetSequencerBackendForTests,
9431
9495
  resolveInputMappings,
9496
+ resolveInstallPhase,
9432
9497
  resolveQueue,
9433
9498
  resolveSequencer,
9434
9499
  resource,
@@ -9442,6 +9507,7 @@ var index_default = { z: import_v414.z };
9442
9507
  sequencerRelease,
9443
9508
  server,
9444
9509
  setup,
9510
+ splitProvisionEnvSchema,
9445
9511
  toGsm7,
9446
9512
  token,
9447
9513
  validateCRMSchema,
package/dist/schemas.d.ts CHANGED
@@ -3,8 +3,20 @@ export declare const EnvVisibilitySchema: z.ZodEnum<{
3
3
  visible: "visible";
4
4
  encrypted: "encrypted";
5
5
  }>;
6
+ export declare const InstallPhaseSchema: z.ZodEnum<{
7
+ pre_install: "pre_install";
8
+ post_install: "post_install";
9
+ }>;
6
10
  export declare const EnvVariableDefinitionSchema: z.ZodObject<{
7
11
  label: z.ZodString;
12
+ scope: z.ZodOptional<z.ZodEnum<{
13
+ provision: "provision";
14
+ install: "install";
15
+ }>>;
16
+ installPhase: z.ZodOptional<z.ZodEnum<{
17
+ pre_install: "pre_install";
18
+ post_install: "post_install";
19
+ }>>;
8
20
  required: z.ZodOptional<z.ZodBoolean>;
9
21
  visibility: z.ZodOptional<z.ZodEnum<{
10
22
  visible: "visible";
@@ -16,6 +28,14 @@ export declare const EnvVariableDefinitionSchema: z.ZodObject<{
16
28
  }, z.core.$strip>;
17
29
  export declare const EnvSchemaSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
18
30
  label: z.ZodString;
31
+ scope: z.ZodOptional<z.ZodEnum<{
32
+ provision: "provision";
33
+ install: "install";
34
+ }>>;
35
+ installPhase: z.ZodOptional<z.ZodEnum<{
36
+ pre_install: "pre_install";
37
+ post_install: "post_install";
38
+ }>>;
19
39
  required: z.ZodOptional<z.ZodBoolean>;
20
40
  visibility: z.ZodOptional<z.ZodEnum<{
21
41
  visible: "visible";
@@ -329,6 +349,14 @@ export declare const ModelDefinitionSchema: z.ZodObject<{
329
349
  page: z.ZodOptional<z.ZodString>;
330
350
  env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
331
351
  label: z.ZodString;
352
+ scope: z.ZodOptional<z.ZodEnum<{
353
+ provision: "provision";
354
+ install: "install";
355
+ }>>;
356
+ installPhase: z.ZodOptional<z.ZodEnum<{
357
+ pre_install: "pre_install";
358
+ post_install: "post_install";
359
+ }>>;
332
360
  required: z.ZodOptional<z.ZodBoolean>;
333
361
  visibility: z.ZodOptional<z.ZodEnum<{
334
362
  visible: "visible";
@@ -3202,6 +3230,14 @@ export type AgentDefinition = z.infer<typeof AgentDefinitionSchema>;
3202
3230
  export declare const InstallConfigSchema: z.ZodObject<{
3203
3231
  env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
3204
3232
  label: z.ZodString;
3233
+ scope: z.ZodOptional<z.ZodEnum<{
3234
+ provision: "provision";
3235
+ install: "install";
3236
+ }>>;
3237
+ installPhase: z.ZodOptional<z.ZodEnum<{
3238
+ pre_install: "pre_install";
3239
+ post_install: "post_install";
3240
+ }>>;
3205
3241
  required: z.ZodOptional<z.ZodBoolean>;
3206
3242
  visibility: z.ZodOptional<z.ZodEnum<{
3207
3243
  visible: "visible";
@@ -3301,6 +3337,14 @@ export declare const InstallConfigSchema: z.ZodObject<{
3301
3337
  page: z.ZodOptional<z.ZodString>;
3302
3338
  env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
3303
3339
  label: z.ZodString;
3340
+ scope: z.ZodOptional<z.ZodEnum<{
3341
+ provision: "provision";
3342
+ install: "install";
3343
+ }>>;
3344
+ installPhase: z.ZodOptional<z.ZodEnum<{
3345
+ pre_install: "pre_install";
3346
+ post_install: "post_install";
3347
+ }>>;
3304
3348
  required: z.ZodOptional<z.ZodBoolean>;
3305
3349
  visibility: z.ZodOptional<z.ZodEnum<{
3306
3350
  visible: "visible";
@@ -3410,6 +3454,14 @@ export declare const BatchOperationDefinitionSchema: z.ZodObject<{
3410
3454
  export declare const ProvisionConfigSchema: z.ZodObject<{
3411
3455
  env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
3412
3456
  label: z.ZodString;
3457
+ scope: z.ZodOptional<z.ZodEnum<{
3458
+ provision: "provision";
3459
+ install: "install";
3460
+ }>>;
3461
+ installPhase: z.ZodOptional<z.ZodEnum<{
3462
+ pre_install: "pre_install";
3463
+ post_install: "post_install";
3464
+ }>>;
3413
3465
  required: z.ZodOptional<z.ZodBoolean>;
3414
3466
  visibility: z.ZodOptional<z.ZodEnum<{
3415
3467
  visible: "visible";
@@ -3509,6 +3561,14 @@ export declare const ProvisionConfigSchema: z.ZodObject<{
3509
3561
  page: z.ZodOptional<z.ZodString>;
3510
3562
  env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
3511
3563
  label: z.ZodString;
3564
+ scope: z.ZodOptional<z.ZodEnum<{
3565
+ provision: "provision";
3566
+ install: "install";
3567
+ }>>;
3568
+ installPhase: z.ZodOptional<z.ZodEnum<{
3569
+ pre_install: "pre_install";
3570
+ post_install: "post_install";
3571
+ }>>;
3512
3572
  required: z.ZodOptional<z.ZodBoolean>;
3513
3573
  visibility: z.ZodOptional<z.ZodEnum<{
3514
3574
  visible: "visible";
@@ -4243,6 +4303,14 @@ export declare const SkedyulConfigSchema: z.ZodObject<{
4243
4303
  provision: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
4244
4304
  env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
4245
4305
  label: z.ZodString;
4306
+ scope: z.ZodOptional<z.ZodEnum<{
4307
+ provision: "provision";
4308
+ install: "install";
4309
+ }>>;
4310
+ installPhase: z.ZodOptional<z.ZodEnum<{
4311
+ pre_install: "pre_install";
4312
+ post_install: "post_install";
4313
+ }>>;
4246
4314
  required: z.ZodOptional<z.ZodBoolean>;
4247
4315
  visibility: z.ZodOptional<z.ZodEnum<{
4248
4316
  visible: "visible";
@@ -4342,6 +4410,14 @@ export declare const SkedyulConfigSchema: z.ZodObject<{
4342
4410
  page: z.ZodOptional<z.ZodString>;
4343
4411
  env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
4344
4412
  label: z.ZodString;
4413
+ scope: z.ZodOptional<z.ZodEnum<{
4414
+ provision: "provision";
4415
+ install: "install";
4416
+ }>>;
4417
+ installPhase: z.ZodOptional<z.ZodEnum<{
4418
+ pre_install: "pre_install";
4419
+ post_install: "post_install";
4420
+ }>>;
4345
4421
  required: z.ZodOptional<z.ZodBoolean>;
4346
4422
  visibility: z.ZodOptional<z.ZodEnum<{
4347
4423
  visible: "visible";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skedyul",
3
- "version": "1.7.12",
3
+ "version": "1.7.15",
4
4
  "description": "The Skedyul SDK for Node.js",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",