alinea 1.0.0 → 1.0.1

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.
@@ -1,2 +1,2 @@
1
- import { NextConfig } from 'next/dist/types.js';
1
+ import type { NextConfig } from 'next/dist/types.js';
2
2
  export declare function withAlinea(config: NextConfig): NextConfig;
@@ -1,8 +1,13 @@
1
1
  import "../../chunks/chunk-U5RRZUYZ.js";
2
2
 
3
3
  // src/adapter/next/with-alinea.ts
4
- import pkg from "next/package.json";
4
+ import { readFileSync } from "node:fs";
5
+ import { createRequire } from "node:module";
6
+ import { resolve } from "path";
5
7
  function withAlinea(config) {
8
+ const require2 = createRequire(resolve("."));
9
+ const pkgLocation = require2.resolve("next/package.json");
10
+ const pkg = JSON.parse(readFileSync(pkgLocation, "utf-8"));
6
11
  const majorVersion = Number(pkg.version.split(".")[0]);
7
12
  if (majorVersion < 15)
8
13
  return {
@@ -12,7 +17,14 @@ function withAlinea(config) {
12
17
  serverComponentsExternalPackages: [
13
18
  ...config.experimental?.serverComponentsExternalPackages ?? [],
14
19
  "@alinea/generated"
15
- ]
20
+ ],
21
+ turbo: {
22
+ ...config.experimental?.turbo,
23
+ resolveAlias: {
24
+ ...config.experimental?.turbo?.resolveAlias,
25
+ "next/dist/server/app-render/work-unit-async-storage.external.js": "next/dist/client/components/request-async-storage.external.js"
26
+ }
27
+ }
16
28
  }
17
29
  };
18
30
  return {
@@ -12,15 +12,15 @@ export declare function createExample(): import("alinea/core/CMS").CMS<{
12
12
  externalLink: import("alinea/field/link/LinkField").LinkField<import("alinea/types").UrlReference, import("alinea/types").UrlLink<{}>>;
13
13
  entry: import("alinea/field/link/LinkField").LinkField<import("alinea/types").EntryReference, import("alinea/types").EntryLink<undefined>>;
14
14
  entryWithCondition: import("alinea/field/link/LinkField").LinkField<import("alinea/types").EntryReference, import("alinea/types").EntryLink<undefined>>;
15
- linkMultiple: import("alinea/field/link/LinkField").LinksField<(import("alinea/types").EntryReference | import("alinea/types").UrlReference) & import("alinea/core/shape/ListShape").ListRow, import("alinea/types").Link<{}>>;
15
+ linkMultiple: import("alinea/field/link/LinkField").LinksField<import("alinea/field/link").LinkRow, import("alinea/types").Link<{}>>;
16
16
  image: import("alinea/field/link").ImageField<undefined>;
17
17
  images: import("alinea/field/link").ImagesField<undefined>;
18
18
  file: import("alinea/field/link/LinkField").LinkField<import("alinea/types").EntryReference, import("alinea/types").EntryLink<undefined>>;
19
- withFields: import("alinea/field/link/LinkField").LinkField<(import("alinea/types").EntryReference | import("alinea/types").UrlReference) & import("alinea/core/shape/ListShape").ListRow, import("alinea/types").Link<{
19
+ withFields: import("alinea/field/link/LinkField").LinkField<import("alinea/field/link").LinkRow, import("alinea/types").Link<{
20
20
  fieldA: string;
21
21
  fieldB: string;
22
22
  }>>;
23
- multipleWithFields: import("alinea/field/link/LinkField").LinksField<(import("alinea/types").EntryReference | import("alinea/types").UrlReference) & import("alinea/core/shape/ListShape").ListRow, import("alinea/types").Link<{
23
+ multipleWithFields: import("alinea/field/link/LinkField").LinksField<import("alinea/field/link").LinkRow, import("alinea/types").Link<{
24
24
  fieldA: string;
25
25
  fieldB: string;
26
26
  }>>;
@@ -88,7 +88,7 @@ export declare function createExample(): import("alinea/core/CMS").CMS<{
88
88
  }>;
89
89
  Page: import("alinea/core/Type").Type<import("alinea/core/Document").Document & {
90
90
  name: import("alinea/field/path").PathField & import("alinea/field/text").TextField;
91
- entryLink: import("alinea/field/link/LinkField").LinksField<(import("alinea/types").EntryReference | import("alinea/types").UrlReference) & import("alinea/core/shape/ListShape").ListRow, import("alinea/types").Link<{}>>;
91
+ entryLink: import("alinea/field/link/LinkField").LinksField<import("alinea/field/link").LinkRow, import("alinea/types").Link<{}>>;
92
92
  list: import("alinea/core").ListField<{
93
93
  _type: "item";
94
94
  itemId: string;
@@ -2,7 +2,7 @@
2
2
  var package_default = {
3
3
  bin: "./dist/cli.js",
4
4
  name: "alinea",
5
- version: "1.0.0",
5
+ version: "1.0.1",
6
6
  description: "Headless git-based CMS",
7
7
  repository: {
8
8
  type: "git",
package/dist/cli/Serve.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  package_default
3
- } from "../chunks/chunk-COTVTUVE.js";
3
+ } from "../chunks/chunk-ILDDXLDK.js";
4
4
  import "../chunks/chunk-U5RRZUYZ.js";
5
5
 
6
6
  // src/cli/Serve.ts
package/dist/cli/bin.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  package_default
3
- } from "../chunks/chunk-COTVTUVE.js";
3
+ } from "../chunks/chunk-ILDDXLDK.js";
4
4
  import "../chunks/chunk-U5RRZUYZ.js";
5
5
 
6
6
  // node_modules/mri/lib/index.mjs
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  package_default
3
- } from "../chunks/chunk-COTVTUVE.js";
3
+ } from "../chunks/chunk-ILDDXLDK.js";
4
4
  import {
5
5
  PLazy
6
6
  } from "../chunks/chunk-IKINPSS5.js";
@@ -3,12 +3,13 @@ import { EntryFields } from './EntryFields.js';
3
3
  import { Expr } from './Expr.js';
4
4
  import { Field } from './Field.js';
5
5
  import { Type } from './Type.js';
6
+ import { ListRow } from './shape/ListShape.js';
6
7
  type QueryList<T> = Expand<UnionOfValues<{
7
8
  [K in keyof T]: {
8
9
  _type: K;
9
10
  } & Type.Infer<T[K]>;
10
11
  }>>;
11
- export type InferQueryValue<T> = T extends Array<Type<infer X>> ? InferQueryValue<X> : T extends Type<infer Fields> ? Type.Infer<Fields> & EntryFields : T extends Expr<infer QueryValue> ? QueryValue : T extends Record<string, Type> ? QueryList<T> : never;
12
+ export type InferQueryValue<T> = T extends Array<Type<infer X>> ? InferQueryValue<X> : T extends Type<infer Fields> ? Type.Infer<Fields> : T extends Expr<infer QueryValue> ? QueryValue : T extends Record<string, Type> ? QueryList<T> : never;
12
13
  type StoredList<T> = Expand<UnionOfValues<{
13
14
  [K in keyof T]: {
14
15
  _type: K;
@@ -19,4 +20,12 @@ export type StoredRow<Definition> = {
19
20
  };
20
21
  export type InferStoredValue<T> = T extends Type<infer Fields> ? StoredRow<Fields> : T extends Field<infer StoredValue> ? StoredValue : T extends Record<string, Type> ? StoredList<T> : {};
21
22
  export type Infer<T> = InferQueryValue<T>;
23
+ export declare namespace Infer {
24
+ type Entry<T extends Type, TypeName extends string = string> = InferQueryValue<T> & Omit<EntryFields, '_type'> & {
25
+ _type: TypeName;
26
+ };
27
+ type ListItem<T extends Type, TypeName extends string = string> = InferQueryValue<T> & Omit<ListRow, '_type'> & {
28
+ _type: TypeName;
29
+ };
30
+ }
22
31
  export {};
@@ -21,7 +21,7 @@ export interface UploadQuery {
21
21
  file: File | [string, Uint8Array];
22
22
  workspace?: string;
23
23
  root?: string;
24
- parentId?: string;
24
+ parentId?: string | null;
25
25
  createPreview?(blob: Blob): Promise<ImagePreviewDetails>;
26
26
  }
27
27
  export declare class UploadOperation extends Operation {
@@ -45,7 +45,7 @@ export interface CreateQuery<Fields> {
45
45
  type: Type<Fields>;
46
46
  workspace?: string;
47
47
  root?: string;
48
- parentId?: string;
48
+ parentId?: string | null;
49
49
  locale?: string;
50
50
  set?: Partial<StoredRow<Fields>>;
51
51
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  package_default
3
- } from "../../chunks/chunk-COTVTUVE.js";
3
+ } from "../../chunks/chunk-ILDDXLDK.js";
4
4
  import {
5
5
  create as create2
6
6
  } from "../../chunks/chunk-IOTY7UTU.js";
@@ -12,9 +12,8 @@ export type Link<InferredFields> = EntryLink<InferredFields> | UrlLink<InferredF
12
12
  export interface LinkOptions<Definition, Row> extends LinkFieldOptions<Row> {
13
13
  fields?: Definition | Type<Definition>;
14
14
  }
15
- type LinkRow = (EntryReference | UrlReference) & ListRow;
15
+ export type LinkRow = (EntryReference | UrlReference) & ListRow;
16
16
  export declare function link<Fields>(label: Label, options?: WithoutLabel<LinkOptions<Fields, LinkRow>>): LinkField<LinkRow, Link<Type.Infer<Fields>>>;
17
17
  export declare namespace link {
18
18
  function multiple<Fields>(label: Label, options?: WithoutLabel<LinkOptions<Fields, Array<LinkRow>>>): import("alinea/field/link/LinkField").LinksField<LinkRow, Link<{ [K_1 in keyof Fields as Fields[K_1] extends import("alinea/core/Expr").Expr<any> ? K_1 : never]: Fields[K_1] extends import("alinea/core/Expr").Expr<infer T_1> ? T_1 : never; } extends infer T ? { [K in keyof T]: { [K_1 in keyof Fields as Fields[K_1] extends import("alinea/core/Expr").Expr<any> ? K_1 : never]: Fields[K_1] extends import("alinea/core/Expr").Expr<infer T_1> ? T_1 : never; }[K]; } : never>>;
19
19
  }
20
- export {};
package/dist/next.cjs CHANGED
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
6
  var __export = (target, all) => {
9
7
  for (var name in all)
@@ -17,23 +15,20 @@ var __copyProps = (to, from, except, desc) => {
17
15
  }
18
16
  return to;
19
17
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
19
  var with_alinea_exports = {};
30
20
  __export(with_alinea_exports, {
31
21
  withAlinea: () => withAlinea
32
22
  });
33
23
  module.exports = __toCommonJS(with_alinea_exports);
34
- var import_package = __toESM(require("next/package.json"), 1);
24
+ var import_node_fs = require("node:fs");
25
+ var import_node_module = require("node:module");
26
+ var import_path = require("path");
35
27
  function withAlinea(config) {
36
- const majorVersion = Number(import_package.default.version.split(".")[0]);
28
+ const require2 = (0, import_node_module.createRequire)((0, import_path.resolve)("."));
29
+ const pkgLocation = require2.resolve("next/package.json");
30
+ const pkg = JSON.parse((0, import_node_fs.readFileSync)(pkgLocation, "utf-8"));
31
+ const majorVersion = Number(pkg.version.split(".")[0]);
37
32
  if (majorVersion < 15)
38
33
  return {
39
34
  ...config,
@@ -42,7 +37,14 @@ function withAlinea(config) {
42
37
  serverComponentsExternalPackages: [
43
38
  ...config.experimental?.serverComponentsExternalPackages ?? [],
44
39
  "@alinea/generated"
45
- ]
40
+ ],
41
+ turbo: {
42
+ ...config.experimental?.turbo,
43
+ resolveAlias: {
44
+ ...config.experimental?.turbo?.resolveAlias,
45
+ "next/dist/server/app-render/work-unit-async-storage.external.js": "next/dist/client/components/request-async-storage.external.js"
46
+ }
47
+ }
46
48
  }
47
49
  };
48
50
  return {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "bin": "./dist/cli.js",
3
3
  "name": "alinea",
4
- "version": "1.0.0",
4
+ "version": "1.0.1",
5
5
  "description": "Headless git-based CMS",
6
6
  "repository": {
7
7
  "type": "git",