@meetploy/cli 1.18.1 → 1.19.0

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.
@@ -4,7 +4,7 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>Ploy Dev Dashboard</title>
7
- <script type="module" crossorigin src="/assets/main-BFhQn9QT.js"></script>
7
+ <script type="module" crossorigin src="/assets/main-CZRtZPnP.js"></script>
8
8
  <link rel="stylesheet" crossorigin href="/assets/main-5Kt9I_hM.css">
9
9
  </head>
10
10
  <body>
package/dist/index.js CHANGED
@@ -6303,7 +6303,6 @@ async function updateTsConfigInclude(cwd, outputPath) {
6303
6303
  }
6304
6304
  }
6305
6305
  function generateEnvType(config) {
6306
- const imports = [];
6307
6306
  const properties = [];
6308
6307
  if (config.env && Object.keys(config.env).length > 0) {
6309
6308
  const varProps = Object.keys(config.env).map((key) => ` ${key}: string;`).join("\n");
@@ -6316,61 +6315,47 @@ ${varProps}
6316
6315
  properties.push(" AI_TOKEN: string;");
6317
6316
  }
6318
6317
  if (config.db) {
6319
- imports.push("D1Database");
6320
6318
  for (const bindingName of Object.keys(config.db)) {
6321
6319
  properties.push(` ${bindingName}: D1Database;`);
6322
6320
  }
6323
6321
  }
6324
6322
  if (config.queue) {
6325
- imports.push("QueueBinding");
6326
6323
  for (const bindingName of Object.keys(config.queue)) {
6327
6324
  properties.push(` ${bindingName}: QueueBinding;`);
6328
6325
  }
6329
6326
  }
6330
6327
  if (config.cache) {
6331
- imports.push("CacheBinding");
6332
6328
  for (const bindingName of Object.keys(config.cache)) {
6333
6329
  properties.push(` ${bindingName}: CacheBinding;`);
6334
6330
  }
6335
6331
  }
6336
6332
  if (config.state) {
6337
- imports.push("StateBinding");
6338
6333
  for (const bindingName of Object.keys(config.state)) {
6339
6334
  properties.push(` ${bindingName}: StateBinding;`);
6340
6335
  }
6341
6336
  }
6342
6337
  if (config.workflow) {
6343
- imports.push("WorkflowBinding");
6344
6338
  for (const bindingName of Object.keys(config.workflow)) {
6345
6339
  properties.push(` ${bindingName}: WorkflowBinding;`);
6346
6340
  }
6347
6341
  }
6348
6342
  if (config.fs) {
6349
- const fsKeys = Object.keys(config.fs);
6350
- if (fsKeys.length > 0) {
6351
- imports.push("FileStorageBinding");
6352
- for (const bindingName of fsKeys) {
6353
- properties.push(` ${bindingName}: FileStorageBinding;`);
6354
- }
6343
+ for (const bindingName of Object.keys(config.fs)) {
6344
+ properties.push(` ${bindingName}: FileStorageBinding;`);
6355
6345
  }
6356
6346
  }
6357
6347
  if (config.timer) {
6358
- const timerKeys = Object.keys(config.timer);
6359
- if (timerKeys.length > 0) {
6360
- imports.push("TimerBinding");
6361
- for (const bindingName of timerKeys) {
6362
- properties.push(` ${bindingName}: TimerBinding;`);
6363
- }
6348
+ for (const bindingName of Object.keys(config.timer)) {
6349
+ properties.push(` ${bindingName}: TimerBinding;`);
6364
6350
  }
6365
6351
  }
6352
+ if (config.auth) {
6353
+ properties.push(` PLOY_AUTH: PloyAuth;`);
6354
+ }
6366
6355
  const lines = [
6367
6356
  "// This file is auto-generated by `ploy types`. Do not edit manually.",
6368
6357
  ""
6369
6358
  ];
6370
- if (imports.length > 0) {
6371
- lines.push(`import type { ${imports.join(", ")} } from "@meetploy/types";`);
6372
- lines.push("");
6373
- }
6374
6359
  lines.push('declare module "@meetploy/nextjs" {');
6375
6360
  lines.push(" interface PloyEnv {");
6376
6361
  for (const prop of properties) {
@@ -6379,7 +6364,69 @@ ${varProps}
6379
6364
  lines.push(" }");
6380
6365
  lines.push("}");
6381
6366
  lines.push("");
6367
+ const p = "@meetploy/types";
6382
6368
  lines.push("declare global {");
6369
+ lines.push(
6370
+ ` type PloyHandler<TEnv = unknown> = import("${p}").PloyHandler<TEnv>;`
6371
+ );
6372
+ lines.push(` type Ploy = PloyHandler<PloyEnv>;`);
6373
+ lines.push(` interface PloyRequest {`);
6374
+ lines.push(` readonly method: string;`);
6375
+ lines.push(` readonly url: string;`);
6376
+ lines.push(` readonly headers: Headers;`);
6377
+ lines.push(` readonly redirect: string;`);
6378
+ lines.push(` readonly signal: AbortSignal;`);
6379
+ lines.push(` readonly integrity: string;`);
6380
+ lines.push(` readonly keepalive: boolean;`);
6381
+ lines.push(` readonly body: ReadableStream | null;`);
6382
+ lines.push(` readonly bodyUsed: boolean;`);
6383
+ lines.push(` clone(): PloyRequest;`);
6384
+ lines.push(` arrayBuffer(): Promise<ArrayBuffer>;`);
6385
+ lines.push(` bytes(): Promise<Uint8Array>;`);
6386
+ lines.push(` text(): Promise<string>;`);
6387
+ lines.push(` json<T>(): Promise<T>;`);
6388
+ lines.push(` formData(): Promise<FormData>;`);
6389
+ lines.push(` blob(): Promise<Blob>;`);
6390
+ lines.push(` }`);
6391
+ lines.push("");
6392
+ lines.push(` interface PloyResponse {`);
6393
+ lines.push(` readonly status: number;`);
6394
+ lines.push(` readonly statusText: string;`);
6395
+ lines.push(` readonly headers: Headers;`);
6396
+ lines.push(` readonly ok: boolean;`);
6397
+ lines.push(` readonly redirected: boolean;`);
6398
+ lines.push(` readonly url: string;`);
6399
+ lines.push(` readonly body: ReadableStream | null;`);
6400
+ lines.push(` readonly bodyUsed: boolean;`);
6401
+ lines.push(` clone(): PloyResponse;`);
6402
+ lines.push(` arrayBuffer(): Promise<ArrayBuffer>;`);
6403
+ lines.push(` bytes(): Promise<Uint8Array>;`);
6404
+ lines.push(` text(): Promise<string>;`);
6405
+ lines.push(` json<T>(): Promise<T>;`);
6406
+ lines.push(` formData(): Promise<FormData>;`);
6407
+ lines.push(` blob(): Promise<Blob>;`);
6408
+ lines.push(` }`);
6409
+ lines.push("");
6410
+ lines.push(` // Binding types`);
6411
+ lines.push(` type D1Database = import("${p}").D1Database;`);
6412
+ lines.push(` type CacheBinding = import("${p}").CacheBinding;`);
6413
+ lines.push(` type QueueBinding = import("${p}").QueueBinding;`);
6414
+ lines.push(` type StateBinding = import("${p}").StateBinding;`);
6415
+ lines.push(` type WorkflowBinding = import("${p}").WorkflowBinding;`);
6416
+ lines.push(` type FileStorageBinding = import("${p}").FileStorageBinding;`);
6417
+ lines.push(` type TimerBinding = import("${p}").TimerBinding;`);
6418
+ lines.push(` type PloyAuth = import("${p}").PloyAuth;`);
6419
+ lines.push(` type PloyUser = import("${p}").PloyUser;`);
6420
+ lines.push("");
6421
+ lines.push(` // Handler and context types`);
6422
+ lines.push(
6423
+ ` type WorkflowContext<TEnv = unknown, TInput = unknown> = import("${p}").WorkflowContext<TEnv, TInput>;`
6424
+ );
6425
+ lines.push(` type QueueMessageEvent = import("${p}").QueueMessageEvent;`);
6426
+ lines.push(` type ScheduledEvent = import("${p}").ScheduledEvent;`);
6427
+ lines.push(` type TimerEvent = import("${p}").TimerEvent;`);
6428
+ lines.push(` type ExecutionContext = import("${p}").ExecutionContext;`);
6429
+ lines.push("");
6383
6430
  lines.push(" interface PloyEnv {");
6384
6431
  for (const prop of properties) {
6385
6432
  lines.push(` ${prop}`);
@@ -6404,7 +6451,7 @@ async function typesCommand(options = {}) {
6404
6451
  console.error("Error: ploy.yaml not found in current directory");
6405
6452
  process.exit(1);
6406
6453
  }
6407
- const hasBindings2 = config.env || config.ai || config.db || config.queue || config.cache || config.state || config.workflow || config.fs || config.timer || config.cron;
6454
+ const hasBindings2 = config.env || config.ai || config.db || config.queue || config.cache || config.state || config.workflow || config.fs || config.timer || config.cron || config.auth;
6408
6455
  if (!hasBindings2) {
6409
6456
  console.log("No bindings found in ploy.yaml. Generating empty Env.");
6410
6457
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meetploy/cli",
3
- "version": "1.18.1",
3
+ "version": "1.19.0",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",