@lunora/runtime 1.0.0-alpha.18 → 1.0.0-alpha.19

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/LICENSE.md CHANGED
@@ -103,3 +103,9 @@ Unless required by applicable law or agreed to in writing, software distributed
103
103
  under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
104
104
  CONDITIONS OF ANY KIND, either express or implied. See the License for the
105
105
  specific language governing permissions and limitations under the License.
106
+
107
+ <!-- DEPENDENCIES -->
108
+ <!-- /DEPENDENCIES -->
109
+
110
+ <!-- TYPE_DEPENDENCIES -->
111
+ <!-- /TYPE_DEPENDENCIES -->
package/dist/index.d.mts CHANGED
@@ -197,6 +197,43 @@ interface AuthCapabilities {
197
197
  passkey: boolean;
198
198
  twoFactor: boolean;
199
199
  }
200
+ /** One user-settable extra field for the create-user form, derived from the merged `user` table. */
201
+ interface AuthUserFieldSpec {
202
+ name: string;
203
+ plugin?: string;
204
+ required: boolean;
205
+ type: "boolean" | "date" | "number" | "string";
206
+ unique: boolean;
207
+ }
208
+ /**
209
+ * Rich, read-only description of the deployment's auth configuration — enabled
210
+ * plugins, sign-in methods, user-settable fields, organization sub-features, and
211
+ * session / rate-limit policy — for the studio's config panel and dynamic
212
+ * create-user form. Never carries a secret.
213
+ */
214
+ interface AuthConfigInfo {
215
+ capabilities: AuthCapabilities;
216
+ emailAndPassword: boolean;
217
+ organization: {
218
+ enabled: boolean;
219
+ roles: boolean;
220
+ teams: boolean;
221
+ };
222
+ plugins: string[];
223
+ rateLimit: {
224
+ enabled: boolean;
225
+ max?: number;
226
+ window?: number;
227
+ };
228
+ session: {
229
+ cookieCache?: boolean;
230
+ expiresIn?: number;
231
+ freshAge?: number;
232
+ updateAge?: number;
233
+ };
234
+ socialProviders: string[];
235
+ userFields: AuthUserFieldSpec[];
236
+ }
200
237
  /** Filtering / paging options forwarded to {@link AuthAdmin.listUsers} from the users endpoint's query string. */
201
238
  interface ListAuthUsersOptions {
202
239
  filterField?: string;
@@ -221,6 +258,15 @@ interface ListAuthUsersOptions {
221
258
  * implementation is a trusted server-side operator, not an end-user API.
222
259
  */
223
260
  interface AuthAdmin {
261
+ addMember?: (input: {
262
+ organizationId: string;
263
+ role?: string;
264
+ userId: string;
265
+ }) => Promise<Record<string, unknown>>;
266
+ addTeamMember?: (input: {
267
+ teamId: string;
268
+ userId: string;
269
+ }) => Promise<Record<string, unknown>>;
224
270
  banUser?: (input: {
225
271
  expiresInSeconds?: number;
226
272
  reason?: string;
@@ -230,6 +276,23 @@ interface AuthAdmin {
230
276
  invitationId: string;
231
277
  }) => Promise<void>;
232
278
  capabilities?: () => Promise<AuthCapabilities>;
279
+ config?: () => Promise<AuthConfigInfo>;
280
+ createOrganization?: (input: {
281
+ logo?: string;
282
+ metadata?: Record<string, unknown>;
283
+ name: string;
284
+ ownerId?: string;
285
+ slug?: string;
286
+ }) => Promise<Record<string, unknown>>;
287
+ createOrgRole?: (input: {
288
+ organizationId: string;
289
+ permission: Record<string, string[]>;
290
+ role: string;
291
+ }) => Promise<Record<string, unknown>>;
292
+ createTeam?: (input: {
293
+ name: string;
294
+ organizationId: string;
295
+ }) => Promise<Record<string, unknown>>;
233
296
  createUser?: (input: {
234
297
  data?: Record<string, unknown>;
235
298
  email: string;
@@ -237,6 +300,12 @@ interface AuthAdmin {
237
300
  password?: string;
238
301
  role?: string | string[];
239
302
  }) => Promise<AuthUser>;
303
+ deleteOrganization?: (input: {
304
+ organizationId: string;
305
+ }) => Promise<void>;
306
+ deleteOrgRole?: (input: {
307
+ roleId: string;
308
+ }) => Promise<void>;
240
309
  deletePasskey?: (input: {
241
310
  passkeyId: string;
242
311
  }) => Promise<void>;
@@ -246,6 +315,12 @@ interface AuthAdmin {
246
315
  impersonateUser?: (input: {
247
316
  userId: string;
248
317
  }) => Promise<AuthImpersonation>;
318
+ inviteMember?: (input: {
319
+ email: string;
320
+ inviterId?: string;
321
+ organizationId: string;
322
+ role?: string;
323
+ }) => Promise<Record<string, unknown>>;
249
324
  listAccounts?: (input: {
250
325
  userId: string;
251
326
  }) => Promise<Record<string, unknown>[]>;
@@ -263,6 +338,11 @@ interface AuthAdmin {
263
338
  limit?: number;
264
339
  offset?: number;
265
340
  }) => Promise<AuthPage<Record<string, unknown>>>;
341
+ listOrgRoles?: (options: {
342
+ limit?: number;
343
+ offset?: number;
344
+ organizationId: string;
345
+ }) => Promise<AuthPage<Record<string, unknown>>>;
266
346
  listPasskeys?: (input: {
267
347
  userId: string;
268
348
  }) => Promise<Record<string, unknown>[]>;
@@ -271,10 +351,26 @@ interface AuthAdmin {
271
351
  offset?: number;
272
352
  userId?: string;
273
353
  }) => Promise<AuthPage<AuthSession>>;
354
+ listTeamMembers?: (options: {
355
+ limit?: number;
356
+ offset?: number;
357
+ teamId: string;
358
+ }) => Promise<AuthPage<Record<string, unknown>>>;
359
+ listTeams?: (options: {
360
+ limit?: number;
361
+ offset?: number;
362
+ organizationId: string;
363
+ }) => Promise<AuthPage<Record<string, unknown>>>;
274
364
  listUsers: (options: ListAuthUsersOptions) => Promise<AuthPage<AuthUser>>;
275
365
  removeMember?: (input: {
276
366
  memberId: string;
277
367
  }) => Promise<void>;
368
+ removeTeam?: (input: {
369
+ teamId: string;
370
+ }) => Promise<void>;
371
+ removeTeamMember?: (input: {
372
+ teamMemberId: string;
373
+ }) => Promise<void>;
278
374
  removeUser?: (input: {
279
375
  userId: string;
280
376
  }) => Promise<void>;
@@ -299,6 +395,25 @@ interface AuthAdmin {
299
395
  accountId: string;
300
396
  userId: string;
301
397
  }) => Promise<void>;
398
+ updateMemberRole?: (input: {
399
+ memberId: string;
400
+ role: string | string[];
401
+ }) => Promise<Record<string, unknown>>;
402
+ updateOrganization?: (input: {
403
+ logo?: string;
404
+ metadata?: Record<string, unknown>;
405
+ name?: string;
406
+ organizationId: string;
407
+ slug?: string;
408
+ }) => Promise<Record<string, unknown>>;
409
+ updateOrgRole?: (input: {
410
+ permission: Record<string, string[]>;
411
+ roleId: string;
412
+ }) => Promise<Record<string, unknown>>;
413
+ updateTeam?: (input: {
414
+ name: string;
415
+ teamId: string;
416
+ }) => Promise<Record<string, unknown>>;
302
417
  updateUser?: (input: {
303
418
  data: Record<string, unknown>;
304
419
  userId: string;
@@ -2610,4 +2725,4 @@ declare const analyticsEngineSink: (options: AnalyticsEngineSinkOptions) => Obse
2610
2725
  */
2611
2726
  declare const combineSinks: (...sinks: ObservabilitySink[]) => ObservabilitySink;
2612
2727
  declare const VERSION: string;
2613
- export { type AdminTableResolver, type AirbyteMessage, type AnalyticsEngineDataPointLike, type AnalyticsEngineDatasetLike, type AnalyticsEngineSinkOptions, type AuthAdmin, type AuthCapabilities, type AuthImpersonation, type AuthIntrospector, type AuthPage, type AuthSession, type AuthUser, type BackupManifest, type BackupStore, type ComposeIdentityResolversErrorMode, type ComposeIdentityResolversOptions, type ConnectorChange, type ConnectorSyncPage, type CorsOptions, type CronHandler, type CronJobDispatch, type CronJobInfo, type CrossShardCounter, type CrossShardReader, type CrossShardRelationCapabilities, type CrossShardRelationOptions, type CsrfOptions, DEFAULT_REGISTRY_CACHE_TTL_MS, type DurableObjectJurisdiction, type DynamicShardRegistry, type DynamicShardRegistryOptions, type ExecutionContextLike, type ExportFanOutRequest, type ExportFanOutResult, type FanOutRequest, type FanOutResult, type FanOutSpec, type FivetranResponse, type FrameworkHostHandler, type FrameworkWorkerOptions, type FrameworkWorkerOptionsInput, type FunctionDescriptor, type FunctionRegistryEntry, type FunctionRegistryLike, type GlobalExportFunction as GlobalExportFn, type GlobalImportFunction as GlobalImportFn, type GlobalIntrospector, type GlobalTableInfo as GlobalTableInfoMeta, type GlobalTablePage as GlobalTablePageMeta, type HttpActionContext, type HttpActionLike, type HttpRouterLike, type IdentityContractLike, type IdentityResolver, type IdentityValidation, type ImportFanOutRequest, type ImportFanOutResult, type KvIntrospector, type KvKeyEntry, type KvKeyListResult, type KvNamespaceSummary, type KvValueResult, type ListAuthUsersOptions, type LogEvent, type LogLevel, LunoraError, type LunoraErrorBody, type LunoraHandlerOptions, type LunoraWorker, type MergeStrategy, type MigrationFanOutRequest, type MigrationFanOutResult, NOOP_EXECUTION_CONTEXT, type ObservabilityEvent, type ObservabilitySink, type ObservabilitySinkContext, type QueryCoordinator, type QueryCoordinatorOptions, type RankFanOutRequest, type RankFanOutResult, type RankPageFanOutRequest, type RankPageFanOutResult, type ResolvedSecurity, type ResolvedShard, type Route, type RpcContext, type RpcEnvelope, SHARD_REGISTRY_DO_NAME, type ScheduledControllerLike, type SecurityHeadersOptions, type SecurityOptions, type SentrySinkOptions, type ShardError, type ShardExportOutcome, type ShardImportOutcome, type ShardMigrationOutcome, type ShardNamespaceLike, type ShardRankOutcome, type ShardRankPageOutcome, type ShardRegistry, type ShardTrafficEntry, type ShardTrafficFanOutRequest, type ShardTrafficFanOutResult, type ShardingInfo, type StorageListFunction as StorageListFn, type StorageObject, VERSION, type VectorIndexSummary, type VectorIntrospector, type VectorQueryMatch, type WebhookSinkOptions, type WorkerOptions, analyticsEngineSink, applyJurisdiction, combineSinks, composeIdentityResolvers, composeWorker, consoleSink, createCrossShardRelationCapabilities, createDynamicShardRegistry, createLunoraHandler, createQueryCoordinator, createStaticShardRegistry, createWorker, decorateResponse, defineRpcEnvelope, emitLogEvent, emitRpcEvent, enforceOrigin, handleCorsPreflight, mergeStrategyForAggregate, resolveLunoraOptions, resolveSecurity, resolveShard, routeIdentityResolvers, sentrySink, toAirbyteMessages, toErrorResponse, toFivetranResponse, webhookSink, withFrameworkWorker };
2728
+ export { type AdminTableResolver, type AirbyteMessage, type AnalyticsEngineDataPointLike, type AnalyticsEngineDatasetLike, type AnalyticsEngineSinkOptions, type AuthAdmin, type AuthCapabilities, type AuthConfigInfo, type AuthImpersonation, type AuthIntrospector, type AuthPage, type AuthSession, type AuthUser, type AuthUserFieldSpec, type BackupManifest, type BackupStore, type ComposeIdentityResolversErrorMode, type ComposeIdentityResolversOptions, type ConnectorChange, type ConnectorSyncPage, type CorsOptions, type CronHandler, type CronJobDispatch, type CronJobInfo, type CrossShardCounter, type CrossShardReader, type CrossShardRelationCapabilities, type CrossShardRelationOptions, type CsrfOptions, DEFAULT_REGISTRY_CACHE_TTL_MS, type DurableObjectJurisdiction, type DynamicShardRegistry, type DynamicShardRegistryOptions, type ExecutionContextLike, type ExportFanOutRequest, type ExportFanOutResult, type FanOutRequest, type FanOutResult, type FanOutSpec, type FivetranResponse, type FrameworkHostHandler, type FrameworkWorkerOptions, type FrameworkWorkerOptionsInput, type FunctionDescriptor, type FunctionRegistryEntry, type FunctionRegistryLike, type GlobalExportFunction as GlobalExportFn, type GlobalImportFunction as GlobalImportFn, type GlobalIntrospector, type GlobalTableInfo as GlobalTableInfoMeta, type GlobalTablePage as GlobalTablePageMeta, type HttpActionContext, type HttpActionLike, type HttpRouterLike, type IdentityContractLike, type IdentityResolver, type IdentityValidation, type ImportFanOutRequest, type ImportFanOutResult, type KvIntrospector, type KvKeyEntry, type KvKeyListResult, type KvNamespaceSummary, type KvValueResult, type ListAuthUsersOptions, type LogEvent, type LogLevel, LunoraError, type LunoraErrorBody, type LunoraHandlerOptions, type LunoraWorker, type MergeStrategy, type MigrationFanOutRequest, type MigrationFanOutResult, NOOP_EXECUTION_CONTEXT, type ObservabilityEvent, type ObservabilitySink, type ObservabilitySinkContext, type QueryCoordinator, type QueryCoordinatorOptions, type RankFanOutRequest, type RankFanOutResult, type RankPageFanOutRequest, type RankPageFanOutResult, type ResolvedSecurity, type ResolvedShard, type Route, type RpcContext, type RpcEnvelope, SHARD_REGISTRY_DO_NAME, type ScheduledControllerLike, type SecurityHeadersOptions, type SecurityOptions, type SentrySinkOptions, type ShardError, type ShardExportOutcome, type ShardImportOutcome, type ShardMigrationOutcome, type ShardNamespaceLike, type ShardRankOutcome, type ShardRankPageOutcome, type ShardRegistry, type ShardTrafficEntry, type ShardTrafficFanOutRequest, type ShardTrafficFanOutResult, type ShardingInfo, type StorageListFunction as StorageListFn, type StorageObject, VERSION, type VectorIndexSummary, type VectorIntrospector, type VectorQueryMatch, type WebhookSinkOptions, type WorkerOptions, analyticsEngineSink, applyJurisdiction, combineSinks, composeIdentityResolvers, composeWorker, consoleSink, createCrossShardRelationCapabilities, createDynamicShardRegistry, createLunoraHandler, createQueryCoordinator, createStaticShardRegistry, createWorker, decorateResponse, defineRpcEnvelope, emitLogEvent, emitRpcEvent, enforceOrigin, handleCorsPreflight, mergeStrategyForAggregate, resolveLunoraOptions, resolveSecurity, resolveShard, routeIdentityResolvers, sentrySink, toAirbyteMessages, toErrorResponse, toFivetranResponse, webhookSink, withFrameworkWorker };
package/dist/index.d.ts CHANGED
@@ -197,6 +197,43 @@ interface AuthCapabilities {
197
197
  passkey: boolean;
198
198
  twoFactor: boolean;
199
199
  }
200
+ /** One user-settable extra field for the create-user form, derived from the merged `user` table. */
201
+ interface AuthUserFieldSpec {
202
+ name: string;
203
+ plugin?: string;
204
+ required: boolean;
205
+ type: "boolean" | "date" | "number" | "string";
206
+ unique: boolean;
207
+ }
208
+ /**
209
+ * Rich, read-only description of the deployment's auth configuration — enabled
210
+ * plugins, sign-in methods, user-settable fields, organization sub-features, and
211
+ * session / rate-limit policy — for the studio's config panel and dynamic
212
+ * create-user form. Never carries a secret.
213
+ */
214
+ interface AuthConfigInfo {
215
+ capabilities: AuthCapabilities;
216
+ emailAndPassword: boolean;
217
+ organization: {
218
+ enabled: boolean;
219
+ roles: boolean;
220
+ teams: boolean;
221
+ };
222
+ plugins: string[];
223
+ rateLimit: {
224
+ enabled: boolean;
225
+ max?: number;
226
+ window?: number;
227
+ };
228
+ session: {
229
+ cookieCache?: boolean;
230
+ expiresIn?: number;
231
+ freshAge?: number;
232
+ updateAge?: number;
233
+ };
234
+ socialProviders: string[];
235
+ userFields: AuthUserFieldSpec[];
236
+ }
200
237
  /** Filtering / paging options forwarded to {@link AuthAdmin.listUsers} from the users endpoint's query string. */
201
238
  interface ListAuthUsersOptions {
202
239
  filterField?: string;
@@ -221,6 +258,15 @@ interface ListAuthUsersOptions {
221
258
  * implementation is a trusted server-side operator, not an end-user API.
222
259
  */
223
260
  interface AuthAdmin {
261
+ addMember?: (input: {
262
+ organizationId: string;
263
+ role?: string;
264
+ userId: string;
265
+ }) => Promise<Record<string, unknown>>;
266
+ addTeamMember?: (input: {
267
+ teamId: string;
268
+ userId: string;
269
+ }) => Promise<Record<string, unknown>>;
224
270
  banUser?: (input: {
225
271
  expiresInSeconds?: number;
226
272
  reason?: string;
@@ -230,6 +276,23 @@ interface AuthAdmin {
230
276
  invitationId: string;
231
277
  }) => Promise<void>;
232
278
  capabilities?: () => Promise<AuthCapabilities>;
279
+ config?: () => Promise<AuthConfigInfo>;
280
+ createOrganization?: (input: {
281
+ logo?: string;
282
+ metadata?: Record<string, unknown>;
283
+ name: string;
284
+ ownerId?: string;
285
+ slug?: string;
286
+ }) => Promise<Record<string, unknown>>;
287
+ createOrgRole?: (input: {
288
+ organizationId: string;
289
+ permission: Record<string, string[]>;
290
+ role: string;
291
+ }) => Promise<Record<string, unknown>>;
292
+ createTeam?: (input: {
293
+ name: string;
294
+ organizationId: string;
295
+ }) => Promise<Record<string, unknown>>;
233
296
  createUser?: (input: {
234
297
  data?: Record<string, unknown>;
235
298
  email: string;
@@ -237,6 +300,12 @@ interface AuthAdmin {
237
300
  password?: string;
238
301
  role?: string | string[];
239
302
  }) => Promise<AuthUser>;
303
+ deleteOrganization?: (input: {
304
+ organizationId: string;
305
+ }) => Promise<void>;
306
+ deleteOrgRole?: (input: {
307
+ roleId: string;
308
+ }) => Promise<void>;
240
309
  deletePasskey?: (input: {
241
310
  passkeyId: string;
242
311
  }) => Promise<void>;
@@ -246,6 +315,12 @@ interface AuthAdmin {
246
315
  impersonateUser?: (input: {
247
316
  userId: string;
248
317
  }) => Promise<AuthImpersonation>;
318
+ inviteMember?: (input: {
319
+ email: string;
320
+ inviterId?: string;
321
+ organizationId: string;
322
+ role?: string;
323
+ }) => Promise<Record<string, unknown>>;
249
324
  listAccounts?: (input: {
250
325
  userId: string;
251
326
  }) => Promise<Record<string, unknown>[]>;
@@ -263,6 +338,11 @@ interface AuthAdmin {
263
338
  limit?: number;
264
339
  offset?: number;
265
340
  }) => Promise<AuthPage<Record<string, unknown>>>;
341
+ listOrgRoles?: (options: {
342
+ limit?: number;
343
+ offset?: number;
344
+ organizationId: string;
345
+ }) => Promise<AuthPage<Record<string, unknown>>>;
266
346
  listPasskeys?: (input: {
267
347
  userId: string;
268
348
  }) => Promise<Record<string, unknown>[]>;
@@ -271,10 +351,26 @@ interface AuthAdmin {
271
351
  offset?: number;
272
352
  userId?: string;
273
353
  }) => Promise<AuthPage<AuthSession>>;
354
+ listTeamMembers?: (options: {
355
+ limit?: number;
356
+ offset?: number;
357
+ teamId: string;
358
+ }) => Promise<AuthPage<Record<string, unknown>>>;
359
+ listTeams?: (options: {
360
+ limit?: number;
361
+ offset?: number;
362
+ organizationId: string;
363
+ }) => Promise<AuthPage<Record<string, unknown>>>;
274
364
  listUsers: (options: ListAuthUsersOptions) => Promise<AuthPage<AuthUser>>;
275
365
  removeMember?: (input: {
276
366
  memberId: string;
277
367
  }) => Promise<void>;
368
+ removeTeam?: (input: {
369
+ teamId: string;
370
+ }) => Promise<void>;
371
+ removeTeamMember?: (input: {
372
+ teamMemberId: string;
373
+ }) => Promise<void>;
278
374
  removeUser?: (input: {
279
375
  userId: string;
280
376
  }) => Promise<void>;
@@ -299,6 +395,25 @@ interface AuthAdmin {
299
395
  accountId: string;
300
396
  userId: string;
301
397
  }) => Promise<void>;
398
+ updateMemberRole?: (input: {
399
+ memberId: string;
400
+ role: string | string[];
401
+ }) => Promise<Record<string, unknown>>;
402
+ updateOrganization?: (input: {
403
+ logo?: string;
404
+ metadata?: Record<string, unknown>;
405
+ name?: string;
406
+ organizationId: string;
407
+ slug?: string;
408
+ }) => Promise<Record<string, unknown>>;
409
+ updateOrgRole?: (input: {
410
+ permission: Record<string, string[]>;
411
+ roleId: string;
412
+ }) => Promise<Record<string, unknown>>;
413
+ updateTeam?: (input: {
414
+ name: string;
415
+ teamId: string;
416
+ }) => Promise<Record<string, unknown>>;
302
417
  updateUser?: (input: {
303
418
  data: Record<string, unknown>;
304
419
  userId: string;
@@ -2610,4 +2725,4 @@ declare const analyticsEngineSink: (options: AnalyticsEngineSinkOptions) => Obse
2610
2725
  */
2611
2726
  declare const combineSinks: (...sinks: ObservabilitySink[]) => ObservabilitySink;
2612
2727
  declare const VERSION: string;
2613
- export { type AdminTableResolver, type AirbyteMessage, type AnalyticsEngineDataPointLike, type AnalyticsEngineDatasetLike, type AnalyticsEngineSinkOptions, type AuthAdmin, type AuthCapabilities, type AuthImpersonation, type AuthIntrospector, type AuthPage, type AuthSession, type AuthUser, type BackupManifest, type BackupStore, type ComposeIdentityResolversErrorMode, type ComposeIdentityResolversOptions, type ConnectorChange, type ConnectorSyncPage, type CorsOptions, type CronHandler, type CronJobDispatch, type CronJobInfo, type CrossShardCounter, type CrossShardReader, type CrossShardRelationCapabilities, type CrossShardRelationOptions, type CsrfOptions, DEFAULT_REGISTRY_CACHE_TTL_MS, type DurableObjectJurisdiction, type DynamicShardRegistry, type DynamicShardRegistryOptions, type ExecutionContextLike, type ExportFanOutRequest, type ExportFanOutResult, type FanOutRequest, type FanOutResult, type FanOutSpec, type FivetranResponse, type FrameworkHostHandler, type FrameworkWorkerOptions, type FrameworkWorkerOptionsInput, type FunctionDescriptor, type FunctionRegistryEntry, type FunctionRegistryLike, type GlobalExportFunction as GlobalExportFn, type GlobalImportFunction as GlobalImportFn, type GlobalIntrospector, type GlobalTableInfo as GlobalTableInfoMeta, type GlobalTablePage as GlobalTablePageMeta, type HttpActionContext, type HttpActionLike, type HttpRouterLike, type IdentityContractLike, type IdentityResolver, type IdentityValidation, type ImportFanOutRequest, type ImportFanOutResult, type KvIntrospector, type KvKeyEntry, type KvKeyListResult, type KvNamespaceSummary, type KvValueResult, type ListAuthUsersOptions, type LogEvent, type LogLevel, LunoraError, type LunoraErrorBody, type LunoraHandlerOptions, type LunoraWorker, type MergeStrategy, type MigrationFanOutRequest, type MigrationFanOutResult, NOOP_EXECUTION_CONTEXT, type ObservabilityEvent, type ObservabilitySink, type ObservabilitySinkContext, type QueryCoordinator, type QueryCoordinatorOptions, type RankFanOutRequest, type RankFanOutResult, type RankPageFanOutRequest, type RankPageFanOutResult, type ResolvedSecurity, type ResolvedShard, type Route, type RpcContext, type RpcEnvelope, SHARD_REGISTRY_DO_NAME, type ScheduledControllerLike, type SecurityHeadersOptions, type SecurityOptions, type SentrySinkOptions, type ShardError, type ShardExportOutcome, type ShardImportOutcome, type ShardMigrationOutcome, type ShardNamespaceLike, type ShardRankOutcome, type ShardRankPageOutcome, type ShardRegistry, type ShardTrafficEntry, type ShardTrafficFanOutRequest, type ShardTrafficFanOutResult, type ShardingInfo, type StorageListFunction as StorageListFn, type StorageObject, VERSION, type VectorIndexSummary, type VectorIntrospector, type VectorQueryMatch, type WebhookSinkOptions, type WorkerOptions, analyticsEngineSink, applyJurisdiction, combineSinks, composeIdentityResolvers, composeWorker, consoleSink, createCrossShardRelationCapabilities, createDynamicShardRegistry, createLunoraHandler, createQueryCoordinator, createStaticShardRegistry, createWorker, decorateResponse, defineRpcEnvelope, emitLogEvent, emitRpcEvent, enforceOrigin, handleCorsPreflight, mergeStrategyForAggregate, resolveLunoraOptions, resolveSecurity, resolveShard, routeIdentityResolvers, sentrySink, toAirbyteMessages, toErrorResponse, toFivetranResponse, webhookSink, withFrameworkWorker };
2728
+ export { type AdminTableResolver, type AirbyteMessage, type AnalyticsEngineDataPointLike, type AnalyticsEngineDatasetLike, type AnalyticsEngineSinkOptions, type AuthAdmin, type AuthCapabilities, type AuthConfigInfo, type AuthImpersonation, type AuthIntrospector, type AuthPage, type AuthSession, type AuthUser, type AuthUserFieldSpec, type BackupManifest, type BackupStore, type ComposeIdentityResolversErrorMode, type ComposeIdentityResolversOptions, type ConnectorChange, type ConnectorSyncPage, type CorsOptions, type CronHandler, type CronJobDispatch, type CronJobInfo, type CrossShardCounter, type CrossShardReader, type CrossShardRelationCapabilities, type CrossShardRelationOptions, type CsrfOptions, DEFAULT_REGISTRY_CACHE_TTL_MS, type DurableObjectJurisdiction, type DynamicShardRegistry, type DynamicShardRegistryOptions, type ExecutionContextLike, type ExportFanOutRequest, type ExportFanOutResult, type FanOutRequest, type FanOutResult, type FanOutSpec, type FivetranResponse, type FrameworkHostHandler, type FrameworkWorkerOptions, type FrameworkWorkerOptionsInput, type FunctionDescriptor, type FunctionRegistryEntry, type FunctionRegistryLike, type GlobalExportFunction as GlobalExportFn, type GlobalImportFunction as GlobalImportFn, type GlobalIntrospector, type GlobalTableInfo as GlobalTableInfoMeta, type GlobalTablePage as GlobalTablePageMeta, type HttpActionContext, type HttpActionLike, type HttpRouterLike, type IdentityContractLike, type IdentityResolver, type IdentityValidation, type ImportFanOutRequest, type ImportFanOutResult, type KvIntrospector, type KvKeyEntry, type KvKeyListResult, type KvNamespaceSummary, type KvValueResult, type ListAuthUsersOptions, type LogEvent, type LogLevel, LunoraError, type LunoraErrorBody, type LunoraHandlerOptions, type LunoraWorker, type MergeStrategy, type MigrationFanOutRequest, type MigrationFanOutResult, NOOP_EXECUTION_CONTEXT, type ObservabilityEvent, type ObservabilitySink, type ObservabilitySinkContext, type QueryCoordinator, type QueryCoordinatorOptions, type RankFanOutRequest, type RankFanOutResult, type RankPageFanOutRequest, type RankPageFanOutResult, type ResolvedSecurity, type ResolvedShard, type Route, type RpcContext, type RpcEnvelope, SHARD_REGISTRY_DO_NAME, type ScheduledControllerLike, type SecurityHeadersOptions, type SecurityOptions, type SentrySinkOptions, type ShardError, type ShardExportOutcome, type ShardImportOutcome, type ShardMigrationOutcome, type ShardNamespaceLike, type ShardRankOutcome, type ShardRankPageOutcome, type ShardRegistry, type ShardTrafficEntry, type ShardTrafficFanOutRequest, type ShardTrafficFanOutResult, type ShardingInfo, type StorageListFunction as StorageListFn, type StorageObject, VERSION, type VectorIndexSummary, type VectorIntrospector, type VectorQueryMatch, type WebhookSinkOptions, type WorkerOptions, analyticsEngineSink, applyJurisdiction, combineSinks, composeIdentityResolvers, composeWorker, consoleSink, createCrossShardRelationCapabilities, createDynamicShardRegistry, createLunoraHandler, createQueryCoordinator, createStaticShardRegistry, createWorker, decorateResponse, defineRpcEnvelope, emitLogEvent, emitRpcEvent, enforceOrigin, handleCorsPreflight, mergeStrategyForAggregate, resolveLunoraOptions, resolveSecurity, resolveShard, routeIdentityResolvers, sentrySink, toAirbyteMessages, toErrorResponse, toFivetranResponse, webhookSink, withFrameworkWorker };
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  export { toAirbyteMessages, toFivetranResponse } from './packem_shared/toAirbyteMessages-DrHdplb4.mjs';
2
- export { composeWorker, createLunoraHandler, createWorker, defineRpcEnvelope, resolveLunoraOptions, withFrameworkWorker } from './packem_shared/composeWorker-CR1Z2s7k.mjs';
2
+ export { composeWorker, createLunoraHandler, createWorker, defineRpcEnvelope, resolveLunoraOptions, withFrameworkWorker } from './packem_shared/composeWorker-B8fPlc94.mjs';
3
3
  export { createCrossShardRelationCapabilities } from './packem_shared/createCrossShardRelationCapabilities-CbcWjkAn.mjs';
4
4
  export { DEFAULT_REGISTRY_CACHE_TTL_MS, SHARD_REGISTRY_DO_NAME, createDynamicShardRegistry } from './packem_shared/DEFAULT_REGISTRY_CACHE_TTL_MS-B3pA7aXp.mjs';
5
5
  export { LunoraError, toErrorResponse } from './packem_shared/LunoraError-Bpb9EFJ3.mjs';
@@ -12,6 +12,9 @@ const relayName = (ownerKey, index) => `${ownerKey}${RELAY_NAME_INFIX}${String(i
12
12
 
13
13
  const AUTH_BASE = "/_lunora/admin/auth";
14
14
  const AUTH_ADMIN_ERROR_STATUS = {
15
+ INVITER_REQUIRED: 400,
16
+ ORG_SLUG_INVALID: 400,
17
+ ORG_SLUG_TAKEN: 409,
15
18
  PASSWORD_TOO_LONG: 400,
16
19
  PASSWORD_TOO_SHORT: 400,
17
20
  USER_ALREADY_EXISTS: 409,
@@ -41,6 +44,23 @@ const parseRoleInput = (value) => {
41
44
  return void 0;
42
45
  };
43
46
  const optionalBodyString = (body, field) => typeof body[field] === "string" ? body[field] : void 0;
47
+ const optionalBodyObject = (body, field) => {
48
+ const value = body[field];
49
+ return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
50
+ };
51
+ const requirePermission = (body) => {
52
+ const value = body["permission"];
53
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
54
+ throw new LunoraError("`permission` object is required", { code: "BAD_REQUEST", status: 400 });
55
+ }
56
+ const out = {};
57
+ for (const [resource, actions] of Object.entries(value)) {
58
+ if (Array.isArray(actions) && actions.every((action) => typeof action === "string")) {
59
+ out[resource] = actions;
60
+ }
61
+ }
62
+ return out;
63
+ };
44
64
  const AUTH_ROUTES = {
45
65
  [`${AUTH_BASE}/capabilities`]: {
46
66
  build: () => {
@@ -107,6 +127,34 @@ const AUTH_ROUTES = {
107
127
  http: "GET",
108
128
  method: "listInvitations"
109
129
  },
130
+ [`${AUTH_BASE}/config`]: {
131
+ build: () => {
132
+ return {};
133
+ },
134
+ http: "GET",
135
+ method: "config"
136
+ },
137
+ [`${AUTH_BASE}/organizations/teams`]: {
138
+ build: ({ paging, query }) => {
139
+ return { ...paging, organizationId: requireQuery$1(query, "organizationId") };
140
+ },
141
+ http: "GET",
142
+ method: "listTeams"
143
+ },
144
+ [`${AUTH_BASE}/organizations/teams/members`]: {
145
+ build: ({ paging, query }) => {
146
+ return { ...paging, teamId: requireQuery$1(query, "teamId") };
147
+ },
148
+ http: "GET",
149
+ method: "listTeamMembers"
150
+ },
151
+ [`${AUTH_BASE}/organizations/roles`]: {
152
+ build: ({ paging, query }) => {
153
+ return { ...paging, organizationId: requireQuery$1(query, "organizationId") };
154
+ },
155
+ http: "GET",
156
+ method: "listOrgRoles"
157
+ },
110
158
  // --- mutations (POST) -------------------------------------------------------
111
159
  [`${AUTH_BASE}/users/create`]: {
112
160
  build: ({ body }) => {
@@ -239,6 +287,137 @@ const AUTH_ROUTES = {
239
287
  http: "POST",
240
288
  method: "cancelInvitation",
241
289
  returns: "void"
290
+ },
291
+ [`${AUTH_BASE}/organizations/create`]: {
292
+ build: ({ body }) => {
293
+ return {
294
+ logo: optionalBodyString(body, "logo"),
295
+ metadata: optionalBodyObject(body, "metadata"),
296
+ name: requireBodyString(body, "name"),
297
+ ownerId: optionalBodyString(body, "ownerId"),
298
+ slug: optionalBodyString(body, "slug")
299
+ };
300
+ },
301
+ http: "POST",
302
+ method: "createOrganization"
303
+ },
304
+ [`${AUTH_BASE}/organizations/update`]: {
305
+ build: ({ body }) => {
306
+ return {
307
+ logo: optionalBodyString(body, "logo"),
308
+ metadata: optionalBodyObject(body, "metadata"),
309
+ name: optionalBodyString(body, "name"),
310
+ organizationId: requireBodyString(body, "organizationId"),
311
+ slug: optionalBodyString(body, "slug")
312
+ };
313
+ },
314
+ http: "POST",
315
+ method: "updateOrganization"
316
+ },
317
+ [`${AUTH_BASE}/organizations/remove`]: {
318
+ build: ({ body }) => {
319
+ return { organizationId: requireBodyString(body, "organizationId") };
320
+ },
321
+ http: "POST",
322
+ method: "deleteOrganization",
323
+ returns: "void"
324
+ },
325
+ [`${AUTH_BASE}/organizations/members/add`]: {
326
+ build: ({ body }) => {
327
+ return {
328
+ organizationId: requireBodyString(body, "organizationId"),
329
+ role: optionalBodyString(body, "role"),
330
+ userId: requireBodyString(body, "userId")
331
+ };
332
+ },
333
+ http: "POST",
334
+ method: "addMember"
335
+ },
336
+ [`${AUTH_BASE}/organizations/members/invite`]: {
337
+ build: ({ body }) => {
338
+ return {
339
+ email: requireBodyString(body, "email"),
340
+ inviterId: optionalBodyString(body, "inviterId"),
341
+ organizationId: requireBodyString(body, "organizationId"),
342
+ role: optionalBodyString(body, "role")
343
+ };
344
+ },
345
+ http: "POST",
346
+ method: "inviteMember"
347
+ },
348
+ [`${AUTH_BASE}/organizations/members/role`]: {
349
+ build: ({ body }) => {
350
+ const role = parseRoleInput(body["role"]);
351
+ if (role === void 0 || typeof role === "string" && role.trim() === "") {
352
+ throw new LunoraError("`role` is required", { code: "BAD_REQUEST", status: 400 });
353
+ }
354
+ return { memberId: requireBodyString(body, "memberId"), role };
355
+ },
356
+ http: "POST",
357
+ method: "updateMemberRole"
358
+ },
359
+ [`${AUTH_BASE}/organizations/teams/create`]: {
360
+ build: ({ body }) => {
361
+ return { name: requireBodyString(body, "name"), organizationId: requireBodyString(body, "organizationId") };
362
+ },
363
+ http: "POST",
364
+ method: "createTeam"
365
+ },
366
+ [`${AUTH_BASE}/organizations/teams/update`]: {
367
+ build: ({ body }) => {
368
+ return { name: requireBodyString(body, "name"), teamId: requireBodyString(body, "teamId") };
369
+ },
370
+ http: "POST",
371
+ method: "updateTeam"
372
+ },
373
+ [`${AUTH_BASE}/organizations/teams/remove`]: {
374
+ build: ({ body }) => {
375
+ return { teamId: requireBodyString(body, "teamId") };
376
+ },
377
+ http: "POST",
378
+ method: "removeTeam",
379
+ returns: "void"
380
+ },
381
+ [`${AUTH_BASE}/organizations/teams/members/add`]: {
382
+ build: ({ body }) => {
383
+ return { teamId: requireBodyString(body, "teamId"), userId: requireBodyString(body, "userId") };
384
+ },
385
+ http: "POST",
386
+ method: "addTeamMember"
387
+ },
388
+ [`${AUTH_BASE}/organizations/teams/members/remove`]: {
389
+ build: ({ body }) => {
390
+ return { teamMemberId: requireBodyString(body, "teamMemberId") };
391
+ },
392
+ http: "POST",
393
+ method: "removeTeamMember",
394
+ returns: "void"
395
+ },
396
+ [`${AUTH_BASE}/organizations/roles/create`]: {
397
+ build: ({ body }) => {
398
+ return {
399
+ organizationId: requireBodyString(body, "organizationId"),
400
+ permission: requirePermission(body),
401
+ role: requireBodyString(body, "role")
402
+ };
403
+ },
404
+ http: "POST",
405
+ method: "createOrgRole"
406
+ },
407
+ [`${AUTH_BASE}/organizations/roles/update`]: {
408
+ build: ({ body }) => {
409
+ return { permission: requirePermission(body), roleId: requireBodyString(body, "roleId") };
410
+ },
411
+ http: "POST",
412
+ method: "updateOrgRole"
413
+ },
414
+ [`${AUTH_BASE}/organizations/roles/remove`]: {
415
+ build: ({ body }) => {
416
+ return { roleId: requireBodyString(body, "roleId") };
417
+ },
418
+ http: "POST",
419
+ method: "deleteOrgRole",
420
+ returns: "void"
242
421
  }
243
422
  };
244
423
  const buildAuthAdminRoutes = (deps) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/runtime",
3
- "version": "1.0.0-alpha.18",
3
+ "version": "1.0.0-alpha.19",
4
4
  "description": "Lunora Worker runtime: the RPC router, shard resolver, and query coordinator",
5
5
  "keywords": [
6
6
  "cloudflare",