@vivix-labs/media-tools 1.0.0-beta.19 → 1.0.0-beta.20

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/dist/server.js CHANGED
@@ -1841,24 +1841,26 @@ async function activate(ctx) {
1841
1841
  );
1842
1842
  projects.add(ctx.project.id);
1843
1843
  activeProjects.set(workspace, projects);
1844
+ let data;
1844
1845
  try {
1845
- const data = workspace.bind({
1846
+ data = workspace.bind({
1846
1847
  scope: { kind: "project", id: ctx.project.id },
1847
1848
  ownerPackage: "@vivix/media-tools",
1848
1849
  packageVersion,
1849
1850
  actorId: "local",
1850
1851
  access: ["data.workspace"]
1851
1852
  });
1852
- data.register(editType);
1853
- data.register(jobType);
1853
+ const boundData = data;
1854
+ boundData.register(editType);
1855
+ boundData.register(jobType);
1854
1856
  const runtimeRoot = join4(
1855
1857
  ctx.project.root,
1856
1858
  ".vivix",
1857
1859
  "runtime",
1858
1860
  "media-tools",
1859
1861
  ctx.config.executionNamespace
1860
- ), native = new NativeExecutor(), videos = new Videos(data, native, ctx.config, runtimeRoot), edits = new Edits(data, videos), jobs = new Jobs(
1861
- data,
1862
+ ), native = new NativeExecutor(), videos = new Videos(boundData, native, ctx.config, runtimeRoot), edits = new Edits(boundData, videos), jobs = new Jobs(
1863
+ boundData,
1862
1864
  videos,
1863
1865
  native,
1864
1866
  studio.derivedVideos,
@@ -1869,11 +1871,12 @@ async function activate(ctx) {
1869
1871
  const ensureActive = () => {
1870
1872
  if (!active) mediaError("SERVICE_STOPPED", "This media-tools instance has stopped.");
1871
1873
  };
1872
- ctx.onDispose(async () => {
1874
+ ctx.onDispose?.(async () => {
1873
1875
  active = false;
1874
1876
  try {
1875
1877
  await jobs.dispose();
1876
1878
  } finally {
1879
+ boundData.dispose?.();
1877
1880
  projects.delete(ctx.project.id);
1878
1881
  }
1879
1882
  });
@@ -1889,7 +1892,7 @@ async function activate(ctx) {
1889
1892
  }),
1890
1893
  (input, call) => {
1891
1894
  ensureActive();
1892
- return action(input, { ...call, scope: data.scope });
1895
+ return action(input, { ...call, scope: boundData.scope });
1893
1896
  }
1894
1897
  );
1895
1898
  handle("export.capabilities", z4.object({}).strict(), async () => ({
@@ -1898,8 +1901,8 @@ async function activate(ctx) {
1898
1901
  handle("video.resolve", videoInput, (input) => videos.resolve(input));
1899
1902
  handle("edits.get", z4.object({ editRef: versionRef }).strict(), async (input) => {
1900
1903
  const saved = edits.get(input.editRef);
1901
- await data.location(input.editRef);
1902
- await data.location(saved.file.source, saved.file.fileId);
1904
+ await boundData.location(input.editRef);
1905
+ await boundData.location(saved.file.source, saved.file.fileId);
1903
1906
  return saved;
1904
1907
  });
1905
1908
  handle("edits.save", saveEdit, (input, call) => edits.save(input, call), true);
@@ -1925,13 +1928,13 @@ async function activate(ctx) {
1925
1928
  );
1926
1929
  const service = {
1927
1930
  capabilityVersion: "media-tools/1",
1928
- storeId: data.storeId,
1931
+ storeId: boundData.storeId,
1929
1932
  projectId: ctx.project.id,
1930
1933
  getEdit: async (ref) => {
1931
1934
  ensureActive();
1932
1935
  const saved = edits.get(versionRef.parse(ref));
1933
- await data.location(ref);
1934
- await data.location(saved.file.source, saved.file.fileId);
1936
+ await boundData.location(ref);
1937
+ await boundData.location(saved.file.source, saved.file.fileId);
1935
1938
  return saved;
1936
1939
  },
1937
1940
  resolve: (input) => {
@@ -1942,6 +1945,7 @@ async function activate(ctx) {
1942
1945
  ctx.provide(service);
1943
1946
  await jobs.start();
1944
1947
  } catch (error) {
1948
+ data?.dispose?.();
1945
1949
  projects.delete(ctx.project.id);
1946
1950
  throw error;
1947
1951
  }
package/dist/shared.d.ts CHANGED
@@ -513,9 +513,9 @@ declare const exportSettings: z.ZodObject<{
513
513
  resolution: z.ZodUnion<readonly [z.ZodLiteral<"source">, z.ZodLiteral<480>, z.ZodLiteral<720>, z.ZodLiteral<1080>, z.ZodLiteral<2160>]>;
514
514
  frameRate: z.ZodUnion<readonly [z.ZodLiteral<"source">, z.ZodLiteral<24>, z.ZodLiteral<25>, z.ZodLiteral<30>, z.ZodLiteral<50>, z.ZodLiteral<60>]>;
515
515
  quality: z.ZodEnum<{
516
+ small: "small";
516
517
  high: "high";
517
518
  standard: "standard";
518
- small: "small";
519
519
  }>;
520
520
  audio: z.ZodBoolean;
521
521
  }, z.core.$strict>;
@@ -563,9 +563,9 @@ declare const processSequence: z.ZodObject<{
563
563
  resolution: z.ZodUnion<readonly [z.ZodLiteral<"source">, z.ZodLiteral<480>, z.ZodLiteral<720>, z.ZodLiteral<1080>, z.ZodLiteral<2160>]>;
564
564
  frameRate: z.ZodUnion<readonly [z.ZodLiteral<"source">, z.ZodLiteral<24>, z.ZodLiteral<25>, z.ZodLiteral<30>, z.ZodLiteral<50>, z.ZodLiteral<60>]>;
565
565
  quality: z.ZodEnum<{
566
+ small: "small";
566
567
  high: "high";
567
568
  standard: "standard";
568
- small: "small";
569
569
  }>;
570
570
  audio: z.ZodBoolean;
571
571
  }, z.core.$strict>>;
@@ -649,9 +649,9 @@ declare const mediaRequest: z.ZodDiscriminatedUnion<[z.ZodObject<{
649
649
  resolution: z.ZodUnion<readonly [z.ZodLiteral<"source">, z.ZodLiteral<480>, z.ZodLiteral<720>, z.ZodLiteral<1080>, z.ZodLiteral<2160>]>;
650
650
  frameRate: z.ZodUnion<readonly [z.ZodLiteral<"source">, z.ZodLiteral<24>, z.ZodLiteral<25>, z.ZodLiteral<30>, z.ZodLiteral<50>, z.ZodLiteral<60>]>;
651
651
  quality: z.ZodEnum<{
652
+ small: "small";
652
653
  high: "high";
653
654
  standard: "standard";
654
- small: "small";
655
655
  }>;
656
656
  audio: z.ZodBoolean;
657
657
  }, z.core.$strict>>;
@@ -753,9 +753,9 @@ declare const jobsQuery: z.ZodObject<{
753
753
  resolution: z.ZodUnion<readonly [z.ZodLiteral<"source">, z.ZodLiteral<480>, z.ZodLiteral<720>, z.ZodLiteral<1080>, z.ZodLiteral<2160>]>;
754
754
  frameRate: z.ZodUnion<readonly [z.ZodLiteral<"source">, z.ZodLiteral<24>, z.ZodLiteral<25>, z.ZodLiteral<30>, z.ZodLiteral<50>, z.ZodLiteral<60>]>;
755
755
  quality: z.ZodEnum<{
756
+ small: "small";
756
757
  high: "high";
757
758
  standard: "standard";
758
- small: "small";
759
759
  }>;
760
760
  audio: z.ZodBoolean;
761
761
  }, z.core.$strict>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vivix-labs/media-tools",
3
- "version": "1.0.0-beta.19",
3
+ "version": "1.0.0-beta.20",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public",