From 5e382d5b8d0811283a56f073f40679a8f26d2677 Mon Sep 17 00:00:00 2001 From: Ivan S Glazunov Date: Mon, 26 Jun 2023 20:48:28 +0000 Subject: [PATCH] 0.0.198 --- migrations/1687790060025-finder.ts | 33 ++++++++++++++++++++++++++++++ package-lock.json | 15 ++++++++++++-- package.json | 3 ++- 3 files changed, 48 insertions(+), 3 deletions(-) create mode 100644 migrations/1687790060025-finder.ts diff --git a/migrations/1687790060025-finder.ts b/migrations/1687790060025-finder.ts new file mode 100644 index 00000000..c15fbf7d --- /dev/null +++ b/migrations/1687790060025-finder.ts @@ -0,0 +1,33 @@ +import { generateApolloClient } from '@deep-foundation/hasura/client.js'; +import Debug from 'debug'; +import { DeepClient } from '../imports/client.js'; +import npmPackagerPckg from '@deep-foundation/finder/deep.json' assert { type: 'json'}; +import { importPackage, sharePermissions } from './1664940577200-tsx.js'; + +const debug = Debug('deeplinks:migrations:finder'); +const log = debug.extend('log'); +const error = debug.extend('error'); + +const rootClient = generateApolloClient({ + path: `${process.env.MIGRATIONS_HASURA_PATH}/v1/graphql`, + ssl: !!+(process.env.MIGRATIONS_HASURA_SSL || 0), + secret: process.env.MIGRATIONS_HASURA_SECRET, +}); + +const root = new DeepClient({ + apolloClient: rootClient, +}); + +export const up = async () => { + log('up'); + const importResult = await importPackage(npmPackagerPckg); + log(importResult); + const packageId = importResult?.packageId; + if (packageId) { + await sharePermissions(await root.id('deep', 'admin'), packageId); + } +}; + +export const down = async () => { + log('down'); +}; \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index af79bdb8..247ef9aa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,16 +1,17 @@ { "name": "@deep-foundation/deeplinks", - "version": "0.0.196", + "version": "0.0.197", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@deep-foundation/deeplinks", - "version": "0.0.196", + "version": "0.0.197", "license": "Unlicense", "dependencies": { "@apollo/client": "^3.7.14", "@deep-foundation/deepcase": "0.0.21", + "@deep-foundation/finder": "^0.0.3", "@deep-foundation/hasura": "^0.0.45", "@deep-foundation/materialized-path": "0.0.24", "@deep-foundation/npm-packager": "0.0.25", @@ -1047,6 +1048,16 @@ "@deep-foundation/tsx": "^0.0.3" } }, + "node_modules/@deep-foundation/finder": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/@deep-foundation/finder/-/finder-0.0.3.tgz", + "integrity": "sha512-lFUsj59MGbLPyAZ8fmgC2xYUQf6S1H8aEhSQAcqPCs03qMLGHvQejkKquInzj2J+X+Y78UuvgDhUxaoKzNedCA==", + "dependencies": { + "@deep-foundation/core": "^0.0.2", + "@deep-foundation/deepcase": "^0.0.21", + "@deep-foundation/tsx": "^0.0.3" + } + }, "node_modules/@deep-foundation/hasura": { "version": "0.0.45", "resolved": "https://registry.npmjs.org/@deep-foundation/hasura/-/hasura-0.0.45.tgz", diff --git a/package.json b/package.json index 725fbfcf..d45b8834 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@deep-foundation/deeplinks", - "version": "0.0.197", + "version": "0.0.198", "license": "Unlicense", "type": "module", "scripts": { @@ -34,6 +34,7 @@ "dependencies": { "@apollo/client": "^3.7.14", "@deep-foundation/deepcase": "0.0.21", + "@deep-foundation/finder": "^0.0.3", "@deep-foundation/hasura": "^0.0.45", "@deep-foundation/materialized-path": "0.0.24", "@deep-foundation/npm-packager": "0.0.25",