@fungi.computer/oyster 0.36.0 → 0.37.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.
@@ -14455,6 +14455,15 @@ function withConstructorDefault2(defaultValue) {
14455
14455
  function toIssueEffect(self) {
14456
14456
  return catchCause2(self, (cause) => failCauseSync2(() => map3(cause, (error2) => error2.issue)));
14457
14457
  }
14458
+ function withDecodingDefaultKey(defaultValue, options) {
14459
+ const encode4 = options?.encodingStrategy === "omit" ? omit() : passthrough();
14460
+ return (self) => {
14461
+ return optionalKey2(toEncoded2(self)).pipe(decodeTo2(self, {
14462
+ decode: withDefault(toIssueEffect(defaultValue)),
14463
+ encode: encode4
14464
+ }));
14465
+ };
14466
+ }
14458
14467
  function withDecodingDefault(defaultValue, options) {
14459
14468
  const encode4 = options?.encodingStrategy === "omit" ? omit() : passthrough();
14460
14469
  return (self) => {
@@ -20751,20 +20760,35 @@ var appGillWatchSchema = Union2([
20751
20760
  Struct({ storage: meaningful }),
20752
20761
  Struct({ binding: meaningful })
20753
20762
  ]);
20754
- var appDeclaredGillSchema = Struct({
20755
- id: meaningful.pipe(check(makeFilter2((id) => !id.includes(":"), {
20756
- message: "Gill IDs are App-local"
20757
- }))),
20763
+ var identity3 = meaningful.pipe(check(makeFilter2((id) => !id.includes(":"), {
20764
+ message: "Gill IDs are App-local"
20765
+ })));
20766
+ var desktop = Struct({
20767
+ sizes: ArraySchema(Literals(["S", "M", "L"])).check(isMinLength(1), isMaxLength(3), makeFilter2(isUnique, {
20768
+ message: "Desktop Gill sizes must be unique"
20769
+ }))
20770
+ });
20771
+ var rowGill = (view) => Struct({
20772
+ id: identity3,
20773
+ view,
20758
20774
  title: meaningful,
20759
20775
  source: meaningful,
20760
20776
  params: optional2(appGillParamsSchema),
20761
20777
  watch: optional2(appGillWatchSchema),
20762
- desktop: optional2(Struct({
20763
- sizes: ArraySchema(Literals(["S", "M", "L"])).check(isMinLength(1), isMaxLength(3), makeFilter2(isUnique, {
20764
- message: "Desktop Gill sizes must be unique"
20765
- }))
20766
- }))
20778
+ desktop: optional2(desktop)
20767
20779
  });
20780
+ var appDeclaredRowGillSchema = rowGill(Literal2("rows"));
20781
+ var appDeclaredSurfaceGillSchema = Struct({
20782
+ id: identity3,
20783
+ title: meaningful,
20784
+ view: Literal2("surface"),
20785
+ desktop
20786
+ });
20787
+ var appDeclaredGillSchema = Union2([appDeclaredRowGillSchema, appDeclaredSurfaceGillSchema]);
20788
+ var appStoredGillSchema = Union2([
20789
+ rowGill(Literal2("rows").pipe(withDecodingDefaultKey(succeed5("rows")))),
20790
+ appDeclaredSurfaceGillSchema
20791
+ ]);
20768
20792
 
20769
20793
  // ../gills/dist/gill.js
20770
20794
  var gillParamsSchema = Record(appGillParamKeySchema, String4.check(isMaxLength(256))).check(makeFilter2((params) => Object.keys(params).length <= 4, {
@@ -20912,7 +20936,7 @@ var appCallSchema = declareConstructor()([appCallFields], ([fields]) => (input,
20912
20936
  toCodecJson: () => new Link(appCallFields.ast, passthrough2())
20913
20937
  });
20914
20938
  var appCallsSchema = ArraySchema(appCallSchema).check(isMinLength(1), isMaxLength(16), makeFilter2((calls) => isUnique2(calls.map((call) => call.appId)), unique2));
20915
- var appDeclarationSchema = Struct({
20939
+ var declarationSchemaFor = (gill) => Struct({
20916
20940
  api: optionalKey2(appApiSchema),
20917
20941
  displayName: optional2(String4.pipe(check(isMinLength(1)), check(isMaxLength(64)))),
20918
20942
  capabilities: ArraySchema(appCapabilityIdSchema).pipe(check(makeFilter2(isUnique2, unique2))),
@@ -20926,16 +20950,22 @@ var appDeclarationSchema = Struct({
20926
20950
  commands: optional2(ArraySchema(appDeclaredCommandSchema).pipe(check(isMaxLength(64)), check(makeFilter2(commandsAreUnique, {
20927
20951
  message: "Declared command IDs and slash aliases must be unique"
20928
20952
  })))),
20929
- gills: optional2(ArraySchema(appDeclaredGillSchema).pipe(check(isMaxLength(16)), check(makeFilter2(gillsAreUnique, {
20953
+ gills: optional2(ArraySchema(gill).pipe(check(isMaxLength(16)), check(makeFilter2(gillsAreUnique, {
20930
20954
  message: "Declared Gill IDs must be unique"
20931
20955
  })))),
20932
20956
  backend: optional2(Struct({
20933
20957
  bindings: appBackendBindingsSchema,
20934
20958
  sync: optionalKey2(Struct({ method: appApiMethodNameSchema }))
20935
20959
  }))
20936
- }).pipe(check(makeFilter2((declaration3) => declaration3.calls === void 0 || declaration3.capabilities.includes("apps.call"), { message: "App calls require apps.call" })), check(makeFilter2((declaration3) => declaration3.backend?.bindings.every((binding) => binding.name !== "BACKGROUND") ?? true, { message: "BACKGROUND is host-minted and cannot be declared by an App" })), check(makeFilter2((declaration3) => backgroundSyncAllowed(declaration3.api, declaration3.backend?.sync), {
20960
+ }).pipe(check(makeFilter2((declaration3) => declaration3.calls === void 0 || declaration3.capabilities.includes("apps.call"), { message: "App calls require apps.call" })), check(makeFilter2((declaration3) => declaration3.backend?.bindings.every((binding) => binding.name !== "BACKGROUND") ?? true, {
20961
+ message: "BACKGROUND is host-minted and cannot be declared by an App"
20962
+ })), check(makeFilter2((declaration3) => backgroundSyncAllowed(declaration3.api, declaration3.backend?.sync), {
20937
20963
  message: "Background continuation must be a declared write covering all write requirements"
20938
- })), check(makeFilter2((declaration3) => !(declaration3.receives?.includes("git.push") ?? false) || declaration3.capabilities.includes("git.repository"), { message: "Git push reception requires git.repository" })), check(makeFilter2((declaration3) => declaration3.backend?.bindings.every((binding) => binding.operations.every((name) => appBackendBindingOperation(binding.name, name)?.requires.every((capability) => declaration3.capabilities.includes(capability)) === true)) ?? true, { message: "Backend bindings require declared App capabilities" })), check(makeFilter2((declaration3) => !declaration3.backend?.bindings.some((binding) => binding.name === "APP_STORAGE") || (declaration3.storage?.length ?? 0) > 0, { message: "App storage bindings require declared keys" })), check(makeFilter2((declaration3) => Object.values(declaration3.api?.methods ?? {}).every((method2) => method2.requires.every((capability) => declaration3.capabilities.includes(capability))), { message: "App API requires capabilities outside the App declaration" })));
20964
+ })), check(makeFilter2((declaration3) => !(declaration3.receives?.includes("git.push") ?? false) || declaration3.capabilities.includes("git.repository"), { message: "Git push reception requires git.repository" })), check(makeFilter2((declaration3) => declaration3.backend?.bindings.every((binding) => binding.operations.every((name) => appBackendBindingOperation(binding.name, name)?.requires.every((capability) => declaration3.capabilities.includes(capability)) === true)) ?? true, { message: "Backend bindings require declared App capabilities" })), check(makeFilter2((declaration3) => !declaration3.backend?.bindings.some((binding) => binding.name === "APP_STORAGE") || (declaration3.storage?.length ?? 0) > 0, { message: "App storage bindings require declared keys" })), check(makeFilter2((declaration3) => Object.values(declaration3.api?.methods ?? {}).every((method2) => method2.requires.every((capability) => declaration3.capabilities.includes(capability))), {
20965
+ message: "App API requires capabilities outside the App declaration"
20966
+ })));
20967
+ var appDeclarationSchema = declarationSchemaFor(appDeclaredGillSchema);
20968
+ var storedAppDeclarationSchema = declarationSchemaFor(appStoredGillSchema);
20939
20969
 
20940
20970
  // ../../node_modules/.pnpm/nanoid@5.1.16/node_modules/nanoid/index.js
20941
20971
  import { webcrypto as crypto2 } from "node:crypto";
@@ -21322,7 +21352,7 @@ var verifiedAppDescriptionSchema = Struct({
21322
21352
  profile: verifiedBackendProfileSchema
21323
21353
  })),
21324
21354
  // Metadata verified before declarations existed requested nothing.
21325
- declaration: appDeclarationSchema.pipe(withDecodingDefaultType(succeed5(emptyAppDeclaration)))
21355
+ declaration: storedAppDeclarationSchema.pipe(withDecodingDefaultType(succeed5(emptyAppDeclaration)))
21326
21356
  });
21327
21357
  var verifiedArtifactReadSchema = Struct({
21328
21358
  kind: Literal2("verified"),
@@ -21542,7 +21572,7 @@ var appBackendBuildSchema = Struct({
21542
21572
  mediaType: Literal2("application/vnd.fungi.app-backend+json")
21543
21573
  });
21544
21574
  var declaration = {
21545
- declaration: optionalKey2(appDeclarationSchema)
21575
+ declaration: optionalKey2(storedAppDeclarationSchema)
21546
21576
  };
21547
21577
  var appBuildSchema = Union2([
21548
21578
  Struct({
@@ -35,7 +35,15 @@ export function oysterAppCatalog(directory) {
35
35
  surfaceId: app.surfaceId,
36
36
  appId: app.appId,
37
37
  gills: app.gills.map((gill) => {
38
+ if (gill.view === "surface")
39
+ return {
40
+ id: gill.id,
41
+ title: gill.title,
42
+ view: gill.view,
43
+ desktop: { sizes: [...gill.desktop.sizes] },
44
+ };
38
45
  const metadata = {
46
+ view: "rows",
39
47
  id: gill.id,
40
48
  title: gill.title,
41
49
  };