Unified · Split
| @@ -36,7 +36,6 @@ import { createSqliteExecutorBackend } from "@executor/sqlite-sdk-consumer-examp · 35 unmodified lines | ||
| 36 | 36 | const executor = await createExecutor({ |
| 37 | 37 | backend: createSqliteExecutorBackend({ |
| 38 | 38 | databasePath: "./executor.sqlite", |
| 39 | − scopeName: "Acme", | |
| 40 | 39 | }), |
| 41 | 40 | }); |
| 42 | 41 | ``` |
| @@ -8,8 +8,6 @@ const databasePath = process.env.DATABASE_PATH · 7 unmodified lines | ||
| 8 | 8 | const executor = await createExecutor({ |
| 9 | 9 | backend: createSqliteExecutorBackend({ |
| 10 | 10 | databasePath, |
| 11 | − scopeName: "SQLite Example Workspace", | |
| 12 | − scopeRoot: process.cwd(), | |
| 13 | 11 | }), |
| 14 | 12 | }); |
| 15 | 13 | |
| @@ -23,7 +23,7 @@ import type { · 22 unmodified lines | ||
| 23 | 23 | Execution, |
| 24 | 24 | ExecutionInteraction, |
| 25 | 25 | ExecutionStep, |
| 26 | − LocalExecutorConfig, | |
| 26 | + ExecutorScopeConfig, | |
| 27 | 27 | LocalInstallation, |
| 28 | 28 | SecretMaterial, |
| 29 | 29 | SecretRef, |
| @@ -35,6 +35,9 @@ import { · 5 unmodified lines | ||
| 35 | 35 | SourceCatalogIdSchema, |
| 36 | 36 | SourceCatalogRevisionIdSchema, |
| 37 | 37 | } from "@executor/platform-sdk/schema"; |
| 38 | +import type { | |
| 39 | + SecretMaterialStoredDataRecord, | |
| 40 | +} from "@executor/platform-sdk/runtime"; | |
| 38 | 41 | import { |
| 39 | 42 | contentHash, |
| 40 | 43 | snapshotFromSourceCatalogSyncResult, |
| @@ -42,8 +45,6 @@ import { · 1 unmodified line | ||
| 42 | 45 | |
| 43 | 46 | export type CreateSqliteExecutorBackendOptions = { |
| 44 | 47 | databasePath?: string; |
| 45 | − scopeName?: string; | |
| 46 | − scopeRoot?: string | null; | |
| 47 | 48 | scopeId?: string; |
| 48 | 49 | actorScopeId?: string; |
| 49 | 50 | }; |
| @@ -382,7 +383,7 @@ const createStorageDomains = ( · 332 unmodified lines | ||
| 382 | 383 | } |
| 383 | 384 | : null; |
| 384 | 385 | }, |
| 385 | − upsert: (record: { secretId: SecretMaterial["id"]; data: unknown }) => { | |
| 386 | + upsert: (record: SecretMaterialStoredDataRecord) => { | |
| 386 | 387 | store.db.insert(secretMaterialStoredData).values({ |
| 387 | 388 | secretId: record.secretId, |
| 388 | 389 | json: JSON.stringify(record.data), |
| @@ -568,8 +569,6 @@ export const createSqliteExecutorBackend = ( · 179 unmodified lines | ||
| 568 | 569 | |
| 569 | 570 | return { |
| 570 | 571 | scope: { |
| 571 | − scopeName: options.scopeName ?? "SQLite SDK Example", | |
| 572 | − scopeRoot: options.scopeRoot ?? null, | |
| 573 | 572 | metadata: { |
| 574 | 573 | kind: "sqlite", |
| 575 | 574 | databasePath, |
| @@ -601,7 +600,7 @@ export const createSqliteExecutorBackend = ( · 25 unmodified lines | ||
| 601 | 600 | load: () => { |
| 602 | 601 | const row = store.db.select().from(scopeConfigs).where(eq(scopeConfigs.key, "project")).get(); |
| 603 | 602 | const projectConfig = row |
| 604 | − ? parseJson<LocalExecutorConfig>(row.projectConfigJson) | |
| 603 | + ? parseJson<ExecutorScopeConfig>(row.projectConfigJson) | |
| 605 | 604 | : {}; |
| 606 | 605 | return { |
| 607 | 606 | config: projectConfig, |
| @@ -618,7 +617,6 @@ export const createSqliteExecutorBackend = ( · 10 unmodified lines | ||
| 618 | 617 | set: { projectConfigJson: JSON.stringify(config) }, |
| 619 | 618 | }).run(); |
| 620 | 619 | }, |
| 621 | − resolveRelativePath: ({ path, scopeRoot }) => resolvePath(scopeRoot, path), | |
| 622 | 620 | }, |
| 623 | 621 | state: { |
| 624 | 622 | load: () => { |
| @@ -33,7 +33,6 @@ import { · 32 unmodified lines | ||
| 33 | 33 | type LoadedExecutorScopeConfig, |
| 34 | 34 | type ResolvedLocalWorkspaceContext, |
| 35 | 35 | loadExecutorScopeConfig, |
| 36 | − resolveConfigRelativePath, | |
| 37 | 36 | resolveLocalWorkspaceContext, |
| 38 | 37 | writeProjectExecutorScopeConfig, |
| 39 | 38 | } from "./config"; |
| @@ -120,7 +119,6 @@ const createBoundWorkspaceConfigStore = ( · 80 unmodified lines | ||
| 120 | 119 | ): { |
| 121 | 120 | load: () => Effect.Effect<LoadedExecutorScopeConfig, Error, never>; |
| 122 | 121 | writeProject: (config: ExecutorScopeConfig) => Effect.Effect<void, Error, never>; |
| 123 | − resolveRelativePath: typeof resolveConfigRelativePath; | |
| 124 | 122 | } => ({ |
| 125 | 123 | load: () => |
| 126 | 124 | bindFileSystem(fileSystem, loadExecutorScopeConfig(context)).pipe( |
| @@ -131,7 +129,6 @@ const createBoundWorkspaceConfigStore = ( · 4 unmodified lines | ||
| 131 | 129 | fileSystem, |
| 132 | 130 | writeProjectExecutorScopeConfig({ context, config }), |
| 133 | 131 | ).pipe(Effect.mapError(toError)), |
| 134 | − resolveRelativePath: resolveConfigRelativePath, | |
| 135 | 132 | }); |
| 136 | 133 | |
| 137 | 134 | const createBoundWorkspaceStateStore = ( |
| @@ -213,8 +210,6 @@ const createBoundSourceTypeDeclarationsRefresher = ( · 75 unmodified lines | ||
| 213 | 210 | const toExecutorScopeContext = ( |
| 214 | 211 | context: ResolvedLocalWorkspaceContext, |
| 215 | 212 | ): ExecutorScopeDescriptor => ({ |
| 216 | − scopeName: context.workspaceName, | |
| 217 | − scopeRoot: context.workspaceRoot, | |
| 218 | 213 | metadata: { |
| 219 | 214 | kind: "file", |
| 220 | 215 | configDirectory: context.configDirectory, |
| @@ -125,7 +125,6 @@ const toScopeConfigBackend = ( · 124 unmodified lines | ||
| 125 | 125 | ): BoundScopeConfigStore => ({ |
| 126 | 126 | load: () => toEffect(input.load()), |
| 127 | 127 | writeProject: (config) => toEffect(input.writeProject(config)), |
| 128 | − resolveRelativePath: input.resolveRelativePath, | |
| 129 | 128 | }); |
| 130 | 129 | |
| 131 | 130 | const toScopeStateBackend = ( |
| @@ -47,10 +47,7 @@ const policyOps = { · 46 unmodified lines | ||
| 47 | 47 | |
| 48 | 48 | const cloneJson = <T>(value: T): T => JSON.parse(JSON.stringify(value)) as T; |
| 49 | 49 | |
| 50 | −const scopePolicyStableKey = (input: { | |
| 51 | − scopeId: ScopeId; | |
| 52 | − scopeRoot?: string | null; | |
| 53 | −}): string => input.scopeRoot?.trim() || input.scopeId; | |
| 50 | +const scopePolicyStableKey = (scopeId: ScopeId): string => scopeId; | |
| 54 | 51 | |
| 55 | 52 | const localPolicyIdForKey = (input: { |
| 56 | 53 | scopeStableKey: string; |
| @@ -97,10 +94,7 @@ export const loadRuntimeLocalScopePolicies = (scopeId: ScopeId) => · 40 unmodified lines | ||
| 97 | 94 | ([key, policyConfig]) => |
| 98 | 95 | toLocalScopePolicy({ |
| 99 | 96 | scopeId, |
| 100 | − scopeStableKey: scopePolicyStableKey({ | |
| 101 | − scopeId, | |
| 102 | − scopeRoot: runtimeLocalScope.scope.scopeRoot, | |
| 103 | − }), | |
| 97 | + scopeStableKey: scopePolicyStableKey(scopeId), | |
| 104 | 98 | key, |
| 105 | 99 | policyConfig, |
| 106 | 100 | state: scopeState.policies[key], |
| @@ -175,7 +169,7 @@ export const createPolicy = (input: { · 68 unmodified lines | ||
| 175 | 169 | payload: CreatePolicyPayload; |
| 176 | 170 | }) => |
| 177 | 171 | Effect.gen(function* () { |
| 178 | − const runtimeLocalScope = yield* loadScopePolicyContext( | |
| 172 | + yield* loadScopePolicyContext( | |
| 179 | 173 | policyOps.create, |
| 180 | 174 | input.scopeId, |
| 181 | 175 | ); |
| @@ -227,10 +221,7 @@ export const createPolicy = (input: { · 45 unmodified lines | ||
| 227 | 221 | id: |
| 228 | 222 | existingState?.id ?? |
| 229 | 223 | localPolicyIdForKey({ |
| 230 | − scopeStableKey: scopePolicyStableKey({ | |
| 231 | − scopeId: input.scopeId, | |
| 232 | − scopeRoot: runtimeLocalScope.scope.scopeRoot, | |
| 233 | − }), | |
| 224 | + scopeStableKey: scopePolicyStableKey(input.scopeId), | |
| 234 | 225 | key, |
| 235 | 226 | }), |
| 236 | 227 | createdAt: existingState?.createdAt ?? now, |
| @@ -252,10 +243,7 @@ export const createPolicy = (input: { · 15 unmodified lines | ||
| 252 | 243 | |
| 253 | 244 | return toLocalScopePolicy({ |
| 254 | 245 | scopeId: input.scopeId, |
| 255 | − scopeStableKey: scopePolicyStableKey({ | |
| 256 | − scopeId: input.scopeId, | |
| 257 | − scopeRoot: runtimeLocalScope.scope.scopeRoot, | |
| 258 | − }), | |
| 246 | + scopeStableKey: scopePolicyStableKey(input.scopeId), | |
| 259 | 247 | key, |
| 260 | 248 | policyConfig: policies[key]!, |
| 261 | 249 | state: scopeState.policies[key], |
| @@ -297,7 +285,7 @@ export const updatePolicy = (input: { · 35 unmodified lines | ||
| 297 | 285 | payload: UpdatePolicyPayload; |
| 298 | 286 | }) => |
| 299 | 287 | Effect.gen(function* () { |
| 300 | − const runtimeLocalScope = yield* loadScopePolicyContext( | |
| 288 | + yield* loadScopePolicyContext( | |
| 301 | 289 | policyOps.update, |
| 302 | 290 | input.scopeId, |
| 303 | 291 | ); |
| @@ -379,10 +367,7 @@ export const updatePolicy = (input: { · 75 unmodified lines | ||
| 379 | 367 | |
| 380 | 368 | return toLocalScopePolicy({ |
| 381 | 369 | scopeId: input.scopeId, |
| 382 | − scopeStableKey: scopePolicyStableKey({ | |
| 383 | − scopeId: input.scopeId, | |
| 384 | − scopeRoot: runtimeLocalScope.scope.scopeRoot, | |
| 385 | − }), | |
| 370 | + scopeStableKey: scopePolicyStableKey(input.scopeId), | |
| 386 | 371 | key: existing.key, |
| 387 | 372 | policyConfig: policies[existing.key]!, |
| 388 | 373 | state: scopeState.policies[existing.key], |
| @@ -53,7 +53,6 @@ const makeLoadedCatalog = (input: { · 52 unmodified lines | ||
| 53 | 53 | const noopScopeConfigStore = { |
| 54 | 54 | load: () => Effect.die("unexpected config load"), |
| 55 | 55 | writeProject: () => Effect.void, |
| 56 | − resolveRelativePath: (path: string) => Effect.succeed(path), | |
| 57 | 56 | } as any; |
| 58 | 57 | |
| 59 | 58 | const noopScopeStateStore = { |
| @@ -188,7 +188,6 @@ export type BoundScopeConfigStore = { · 187 unmodified lines | ||
| 188 | 188 | writeProject: ( |
| 189 | 189 | config: ExecutorScopeConfig, |
| 190 | 190 | ) => Effect.Effect<void, Error, never>; |
| 191 | − resolveRelativePath: ScopeConfigStoreShape["resolveRelativePath"]; | |
| 192 | 191 | }; |
| 193 | 192 | |
| 194 | 193 | export type BoundScopeStateStore = { |
| @@ -303,7 +302,6 @@ const toScopeConfigStoreShape = ( · 108 unmodified lines | ||
| 303 | 302 | ): ScopeConfigStoreShape => ({ |
| 304 | 303 | load: input.load, |
| 305 | 304 | writeProject: ({ config }) => input.writeProject(config), |
| 306 | − resolveRelativePath: input.resolveRelativePath, | |
| 307 | 305 | }); |
| 308 | 306 | |
| 309 | 307 | const toScopeStateStoreShape = ( |
| @@ -35,7 +35,6 @@ export type ScopeConfigStoreShape = { · 34 unmodified lines | ||
| 35 | 35 | writeProject: (input: { |
| 36 | 36 | config: ExecutorScopeConfig; |
| 37 | 37 | }) => import("effect/Effect").Effect<void, Error, never>; |
| 38 | − resolveRelativePath: (input: { path: string; scopeRoot: string }) => string; | |
| 39 | 38 | }; |
| 40 | 39 | |
| 41 | 40 | export class ScopeConfigStore extends Context.Tag( |
| @@ -3,8 +3,6 @@ import type { · 2 unmodified lines | ||
| 3 | 3 | } from "./schema"; |
| 4 | 4 | |
| 5 | 5 | export type ExecutorScopeDescriptor = { |
| 6 | − scopeName: string; | |
| 7 | − scopeRoot?: string | null; | |
| 8 | 6 | actorScopeId?: ScopeId | null; |
| 9 | 7 | resolutionScopeIds?: ReadonlyArray<ScopeId>; |
| 10 | 8 | metadata?: Readonly<Record<string, unknown>>; |