@absolutejs/sync-pack-favorites 0.2.2 → 0.2.3

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,3 +1,13 @@
1
- import type { SyncPack } from '@absolutejs/sync/engine';
2
- import type { FavoritesPackConfig } from './index';
3
- export declare const manifest: import("@absolutejs/manifest").PackageManifest<FavoritesPackConfig, SyncPack>;
1
+ import type { SyncPack } from "@absolutejs/sync/engine";
2
+ import type { FavoritesPackConfig } from "./index";
3
+ export declare const manifest: Omit<import("@absolutejs/manifest").PackageManifest<FavoritesPackConfig, SyncPack>, "contract" | "settings" | "tools"> & (({
4
+ contract: 1;
5
+ tools?: Record<string, import("@absolutejs/manifest").LegacyManifestTool<SyncPack>> | undefined;
6
+ } | {
7
+ contract: 2;
8
+ tools?: Record<string, import("@absolutejs/manifest").AuthorizedManifestTool<SyncPack>> | undefined;
9
+ }) & {
10
+ settings: import("@sinclair/typebox").TObject<{
11
+ prefix: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
12
+ }>;
13
+ });
package/dist/manifest.js CHANGED
@@ -14,7 +14,7 @@ var __export = (target, all) => {
14
14
  });
15
15
  };
16
16
 
17
- // ../node_modules/.bun/@absolutejs+manifest@0.1.0+78c06a479861f4f9/node_modules/@absolutejs/manifest/dist/index.js
17
+ // ../node_modules/.bun/@absolutejs+manifest@0.4.0+78c06a479861f4f9/node_modules/@absolutejs/manifest/dist/index.js
18
18
  var __defProp2 = Object.defineProperty;
19
19
  var __returnValue2 = (v) => v;
20
20
  function __exportSetter2(name, newValue) {
@@ -29,14 +29,19 @@ var __export2 = (target, all) => {
29
29
  set: __exportSetter2.bind(all, name)
30
30
  });
31
31
  };
32
- var defineManifest = () => (manifest) => {
33
- const defined = manifest;
34
- return defined;
32
+ var defineManifest = () => (manifest) => manifest;
33
+ var literal = (value) => value;
34
+ var RUNTIME_KIND = literal("runtime");
35
+ var WORKSPACE_KIND = literal("workspace");
36
+ var toolFactory = () => {
37
+ function runtime(definition) {
38
+ return { kind: RUNTIME_KIND, ...definition };
39
+ }
40
+ function workspace(definition) {
41
+ return { kind: WORKSPACE_KIND, ...definition };
42
+ }
43
+ return { runtime, workspace };
35
44
  };
36
- var toolFactory = () => ({
37
- runtime: (definition) => ({ kind: "runtime", ...definition }),
38
- workspace: (definition) => ({ kind: "workspace", ...definition })
39
- });
40
45
  function IsAsyncIterator(value) {
41
46
  return IsObject(value) && globalThis.Symbol.asyncIterator in value;
42
47
  }
@@ -774,7 +779,7 @@ function String2(options) {
774
779
  function* FromUnion(syntax) {
775
780
  const trim = syntax.trim().replace(/"|'/g, "");
776
781
  return trim === "boolean" ? yield Boolean() : trim === "number" ? yield Number2() : trim === "bigint" ? yield BigInt2() : trim === "string" ? yield String2() : yield (() => {
777
- const literals = trim.split("|").map((literal) => Literal(literal.trim()));
782
+ const literals = trim.split("|").map((literal2) => Literal(literal2.trim()));
778
783
  return literals.length === 0 ? Never() : literals.length === 1 ? literals[0] : UnionEvaluated(literals);
779
784
  })();
780
785
  }
@@ -3482,10 +3487,10 @@ function ScoreUnion(schema, references, value) {
3482
3487
  const keys = Object.getOwnPropertyNames(value);
3483
3488
  const entries = Object.entries(object.properties);
3484
3489
  return entries.reduce((acc, [key, schema2]) => {
3485
- const literal = schema2[Kind] === "Literal" && schema2.const === value[key] ? 100 : 0;
3490
+ const literal2 = schema2[Kind] === "Literal" && schema2.const === value[key] ? 100 : 0;
3486
3491
  const checks = Check(schema2, references, value[key]) ? 10 : 0;
3487
3492
  const exists = keys.includes(key) ? 1 : 0;
3488
- return acc + (literal + checks + exists);
3493
+ return acc + (literal2 + checks + exists);
3489
3494
  }, 0);
3490
3495
  } else if (schema[Kind] === "Union") {
3491
3496
  const schemas = schema.anyOf.map((schema2) => Deref(schema2, references));
@@ -5822,7 +5827,13 @@ var wiringSnippet = Type.Object({
5822
5827
  Type.Literal("server-plugin")
5823
5828
  ]))
5824
5829
  });
5825
- var clientFrameworks = ["angular", "client", "react", "svelte", "vue"];
5830
+ var clientFrameworks = [
5831
+ "angular",
5832
+ "client",
5833
+ "react",
5834
+ "svelte",
5835
+ "vue"
5836
+ ];
5826
5837
  var wiringRecipe = Type.Object({
5827
5838
  client: Type.Optional(Type.Partial(Type.Object(Object.fromEntries(clientFrameworks.map((framework) => [framework, wiringSnippet]))))),
5828
5839
  description: Type.Optional(Type.String()),
@@ -5887,8 +5898,47 @@ var toolAnnotations = Type.Object({
5887
5898
  readOnlyHint: Type.Optional(Type.Boolean()),
5888
5899
  title: Type.Optional(Type.String())
5889
5900
  });
5901
+ var toolAuthorization = Type.Object({
5902
+ approval: Type.Union([
5903
+ Type.Literal("always"),
5904
+ Type.Literal("never"),
5905
+ Type.Literal("policy")
5906
+ ]),
5907
+ audience: Type.Union([
5908
+ Type.Literal("admin"),
5909
+ Type.Literal("authenticated"),
5910
+ Type.Literal("owner"),
5911
+ Type.Literal("public")
5912
+ ]),
5913
+ compensatingTool: Type.Optional(Type.String({ pattern: TOOL_NAME_PATTERN.source })),
5914
+ destinationFields: Type.Optional(Type.Array(Type.String({ minLength: 1 }), { minItems: 1 })),
5915
+ destinations: Type.Optional(Type.Array(Type.String({ minLength: 1 }), { minItems: 1 })),
5916
+ effects: Type.Array(Type.String({ minLength: 1 }), { minItems: 1 }),
5917
+ idempotency: Type.Optional(Type.Union([
5918
+ Type.Object({
5919
+ field: Type.String({ minLength: 1 }),
5920
+ mode: Type.Literal("field")
5921
+ }),
5922
+ Type.Object({ mode: Type.Literal("host") }),
5923
+ Type.Object({ mode: Type.Literal("resource") })
5924
+ ])),
5925
+ requiredScopes: Type.Optional(Type.Array(Type.String({ minLength: 1 }), { minItems: 1 })),
5926
+ resource: Type.Optional(Type.Object({
5927
+ idField: Type.Optional(Type.String({ minLength: 1 })),
5928
+ ownerIdField: Type.Optional(Type.String({ minLength: 1 })),
5929
+ tenantIdField: Type.Optional(Type.String({ minLength: 1 })),
5930
+ type: Type.String({ minLength: 1 })
5931
+ })),
5932
+ reversible: Type.Optional(Type.Boolean()),
5933
+ spend: Type.Optional(Type.Object({
5934
+ amountMinorField: Type.String({ minLength: 1 }),
5935
+ currencyField: Type.String({ minLength: 1 }),
5936
+ maximumAmountMinor: Type.Optional(Type.Integer({ minimum: 0 }))
5937
+ }))
5938
+ });
5890
5939
  var serializedTool = Type.Object({
5891
5940
  annotations: Type.Optional(toolAnnotations),
5941
+ authorization: Type.Optional(toolAuthorization),
5892
5942
  capabilities: Type.Optional(Type.Array(Type.Union([
5893
5943
  Type.Literal("exec"),
5894
5944
  Type.Literal("glob"),
@@ -5900,7 +5950,15 @@ var serializedTool = Type.Object({
5900
5950
  kind: Type.Union([Type.Literal("runtime"), Type.Literal("workspace")])
5901
5951
  });
5902
5952
  var manifestSchema = Type.Object({
5903
- contract: Type.Literal(1),
5953
+ contract: Type.Union([Type.Literal(1), Type.Literal(2)]),
5954
+ discovery: Type.Optional(Type.Object({
5955
+ audiences: Type.Optional(Type.Array(Type.String({ minLength: 1 }))),
5956
+ certificationUrl: Type.Optional(Type.String()),
5957
+ intents: Type.Optional(Type.Array(Type.String({ minLength: 1 }))),
5958
+ keywords: Type.Optional(Type.Array(Type.String({ minLength: 1 }))),
5959
+ protocols: Type.Optional(Type.Array(Type.String({ minLength: 1 }))),
5960
+ url: Type.Optional(Type.String())
5961
+ })),
5904
5962
  identity: Type.Object({
5905
5963
  accent: Type.Optional(Type.String({ pattern: "^#[0-9a-fA-F]{3,8}$" })),
5906
5964
  category: Type.String({ minLength: 1 }),
@@ -5910,7 +5968,9 @@ var manifestSchema = Type.Object({
5910
5968
  svg: Type.Optional(Type.String()),
5911
5969
  url: Type.Optional(Type.String())
5912
5970
  })),
5913
- name: Type.String({ pattern: "^(@[a-z0-9-~][a-z0-9-._~]*/)?[a-z0-9-~][a-z0-9-._~]*$" }),
5971
+ name: Type.String({
5972
+ pattern: "^(@[a-z0-9-~][a-z0-9-._~]*/)?[a-z0-9-~][a-z0-9-._~]*$"
5973
+ }),
5914
5974
  tagline: Type.String({ minLength: 1 })
5915
5975
  }),
5916
5976
  implements: Type.Optional(Type.Array(adapterImplementation)),
@@ -6883,7 +6943,7 @@ function String3(options) {
6883
6943
  function* FromUnion21(syntax) {
6884
6944
  const trim = syntax.trim().replace(/"|'/g, "");
6885
6945
  return trim === "boolean" ? yield Boolean2() : trim === "number" ? yield Number3() : trim === "bigint" ? yield BigInt3() : trim === "string" ? yield String3() : yield (() => {
6886
- const literals = trim.split("|").map((literal) => Literal2(literal.trim()));
6946
+ const literals = trim.split("|").map((literal2) => Literal2(literal2.trim()));
6887
6947
  return literals.length === 0 ? Never2() : literals.length === 1 ? literals[0] : UnionEvaluated2(literals);
6888
6948
  })();
6889
6949
  }
@@ -8482,7 +8542,7 @@ var Type2 = exports_type6;
8482
8542
  // src/manifest.ts
8483
8543
  var tool = toolFactory();
8484
8544
  var manifest = defineManifest()({
8485
- contract: 1,
8545
+ contract: 2,
8486
8546
  identity: {
8487
8547
  accent: "#eab308",
8488
8548
  category: "sync",
@@ -8500,6 +8560,12 @@ var manifest = defineManifest()({
8500
8560
  tools: {
8501
8561
  pack_surface: tool.runtime({
8502
8562
  annotations: { readOnlyHint: true },
8563
+ authorization: {
8564
+ approval: "never",
8565
+ audience: "owner",
8566
+ effects: ["read"],
8567
+ requiredScopes: ["sync:packs:read"]
8568
+ },
8503
8569
  description: "What this favorites pack adds to the sync engine: the table it owns, its collections (including any resource join), and its mutations.",
8504
8570
  handler: (_input, pack) => JSON.stringify({
8505
8571
  collections: [
@@ -8542,5 +8608,5 @@ export {
8542
8608
  manifest
8543
8609
  };
8544
8610
 
8545
- //# debugId=D03CABF3000C6E1364756E2164756E21
8611
+ //# debugId=BA2091DFB908D67264756E2164756E21
8546
8612
  //# sourceMappingURL=manifest.js.map