Skip to content

Commit cbfd943

Browse files
committed
rebase main
1 parent 243604a commit cbfd943

9 files changed

Lines changed: 17 additions & 53 deletions

File tree

.github/workflows/dockerize.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- uses: actions/checkout@v2
2424
- uses: actions/setup-node@v1
2525
with:
26-
node-version: 18
26+
node-version: '16.20'
2727
- name: ci
2828
run: npm ci
2929
- name: build

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
18
1+
18.16.1

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:18-alpine3.17 AS node
1+
FROM node:18.16.1-alpine3.17 AS node
22
FROM docker:20.10.8-dind-alpine3.14
33

44
COPY --from=node /usr/lib /usr/lib

imports/client.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -349,8 +349,6 @@ export interface DeepClientInstance<L = Link<number>> {
349349

350350
delete<TTable extends 'links'|'numbers'|'strings'|'objects'>(exp: Exp<TTable>, options?: WriteOptions<TTable>):Promise<DeepClientResult<{ id }[]>>;
351351

352-
serial(options: AsyncSerialParams): Promise<DeepClientResult<{ id }[]>>;
353-
354352
reserve<LL = L>(count: number): Promise<number[]>;
355353

356354
await(id: number): Promise<boolean>;
@@ -372,8 +370,6 @@ export interface DeepClientInstance<L = Link<number>> {
372370
logout(): Promise<DeepClientAuthResult>;
373371

374372
can(objectIds: number[], subjectIds: number[], actionIds: number[]): Promise<boolean>;
375-
376-
useDeepSubscription: typeof useDeepSubscription
377373
}
378374

379375
export interface DeepClientAuthResult {
@@ -799,7 +795,9 @@ export class DeepClient<L = Link<number>> implements DeepClientInstance<L> {
799795
return { ...q, data: (q)?.data?.m0?.returning };
800796
};
801797

802-
async serial({
798+
async serial<
799+
LL = L
800+
>({
803801
name, operations, returning, silent
804802
}: AsyncSerialParams): Promise<DeepClientResult<{ id: number }[]>> {
805803
// @ts-ignore
@@ -1070,14 +1068,14 @@ export class DeepClient<L = Link<number>> implements DeepClientInstance<L> {
10701068
try {
10711069
return await DeepClient.resolveDependency(path);
10721070
} catch (e) {
1073-
console.log(`IGNORED ERROR: Call to DeepClient.resolveDependency is failed with`, e);
1071+
console.log(`Call to DeepClient.resolveDependency is failed with`, e);
10741072
}
10751073
}
10761074
if (typeof require !== 'undefined') {
10771075
try {
10781076
return await require(path);
10791077
} catch (e) {
1080-
console.log(`IGNORED ERROR: Call to require is failed with`, e);
1078+
console.log(`Call to require is failed with`, e);
10811079
}
10821080
}
10831081
return await import(path);

imports/packager.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ export class Packager<L extends Link<any>> {
278278
let newId;
279279
if (item.package) {
280280
newId = await this.client.id(pckg?.dependencies?.[item?.package?.dependencyId]?.name, item.package.containValue, true);
281-
if (!newId) pckg.errors.push(`dependency [${pckg?.dependencies?.[item?.package?.dependencyId]?.name} ${item.package.containValue}], not found`);
281+
if (!newId) pckg.errors.push(`dependency [${pckg?.dependencies?.[item?.package?.dependencyId]?.name, item.package.containValue}], not founded`);
282282
} else if (item.type) {
283283
newId = ids[idsIndex++];
284284
}
@@ -371,7 +371,7 @@ export class Packager<L extends Link<any>> {
371371
const ids = await this.client.reserve(counter);
372372
const { global, difference } = await this.globalizeIds(pckg, ids, sorted);
373373
if (pckg.errors?.length) {
374-
return { errors: pckg.errors };
374+
return { errors };
375375
}
376376
await this.insertItems(pckg, global, counter, dependedLinks, errors, mutated);
377377
if (errors.length) return { errors };

migrations/1655979260869-sync-handlers.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ const prepareFunction = /*javascript*/`
334334
const selectValueTable = `\`SELECT * FROM \${table} WHERE link_id = \${linkId}\``;
335335
const selectLinkByValue = `\`SELECT link_id as id FROM \${table} WHERE value = '\${value}'::\${table==='strings' ? 'text' : table==='objects' ? 'jsonb' : 'bigint'}\``;
336336

337-
const generateSelectWhereCode = /*javascript*/`(_where, shift = 0) => {
337+
const generateSelectWhereCode = /*javascript*/`(_where) => {
338338
const where = [];
339339
let values = [];
340340
let valueTable;
@@ -557,7 +557,7 @@ const deepFabric = /*javascript*/`(ownerId, hasura_session) => {
557557
const findLinkIdByValue = ${findLinkIdByValueCode};
558558
const fillValueByLinks = ${fillValueByLinksCode};
559559
const isDeepEqual = ${isDeepEqualCode};
560-
let generated = generateSelectWhere(_where, 1);
560+
let generated = generateSelectWhere(_where);
561561
const where = generated.where;
562562
let links = [];
563563
const valueTableString = generated.valueTable ? generated.valueTable === 'values' ? ' left join "strings" on "strings".link_id = "main".id left join "objects" on "objects".link_id = "main".id left join "numbers" on "numbers".link_id = "main".id' : ' left join "'.concat(generated.valueTable, '" on "',generated.valueTable,'".link_id = "main".id') : '';
@@ -569,7 +569,7 @@ const deepFabric = /*javascript*/`(ownerId, hasura_session) => {
569569
if (options?.table === 'tree'){
570570
const { id, link_id, parent_id, depth, root_id, position_id, tree_id } = _where;
571571
const generateSelectWhere = ${generateSelectWhereCode};
572-
let generated = generateSelectWhere(_where, 1);
572+
let generated = generateSelectWhere(_where);
573573
const where = generated.where;
574574
let links = [];
575575
if (where) links = plv8.execute(${selectTreeWithPermissions}, [ this.linkId, ...generated.values ]);
@@ -795,14 +795,12 @@ const triggerFunctionFabric = (handleOperationTypeId, valueTrigger) => /*javascr
795795
`;
796796

797797
const deepClientFunction = /*javascript*/`
798-
799798
const checkInsertPermission = ${checkInsertPermissionCode};
800799
const checkUpdatePermission = ${checkUpdatePermissionCode};
801800
const checkDeleteLinkPermission = ${checkDeleteLinkPermissionCode};
802801
const hasura_session = JSON.parse(plv8.execute("select current_setting('hasura.user', 't')")[0].current_setting);
803802
const default_role = hasura_session['x-hasura-role'];
804803
const default_user_id = hasura_session['x-hasura-user-id'];
805-
806804
const deep = (${deepFabric})(Number(clientlinkid), hasura_session);
807805
const result = operation === 'id' || operation === 'update' || operation === 'objectSet' || operation === 'objectGet' ? deep[operation](...args) : operation === 'unsafe' ? deep[operation].plv8.execute(...args) : deep[operation](args, options);
808806
if (hasura_session['x-hasura-role'] !== default_role || hasura_session['x-hasura-user-id'] !== default_user_id){

migrations/1693460330175-sync-handlers-update.ts

Lines changed: 0 additions & 31 deletions
This file was deleted.

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,8 @@
2020
"benchmark": "export DEEPLINKS_HASURA_PATH=localhost:8080; export DEEPLINKS_HASURA_SSL=0; export DEEPLINKS_HASURA_SECRET=myadminsecretkey; ts-node benchmarks/index.ts",
2121
"migrate": "npm run package:build && npx migrate@latest up --matches '*.js'",
2222
"unmigrate": "npm run package:build && npx migrate@latest down --matches '*.js'",
23-
"migrate-s-h": "npm run package:build && npx migrate@latest up 1693460330175-sync-handlers-update --matches '*.js'",
24-
"unmigrate-s-h": "npm run package:build && npx migrate@latest down 1693460330175-sync-handlers-update --matches '*.js'",
25-
"remigrate-s-h": "npm run unmigrate-s-h && npm run migrate",
23+
"migrate-s-h": "npm run package:build && npx migrate@latest up 1655979260869-sync-handlers --matches '*.js'",
24+
"unmigrate-s-h": "npm run package:build && npx migrate@latest down 1655979260869-sync-handlers --matches '*.js'",
2625
"start-engine-docker": "npm run start-engine-docker-core",
2726
"start-engine-docker-core": "cd ./node_modules/@deep-foundation/hasura && npm run docker",
2827
"stop-engine-docker": "cd ./node_modules/@deep-foundation/hasura/local && docker-compose --project-name deep down",
@@ -91,7 +90,7 @@
9190
"react": "^18.0.0"
9291
},
9392
"engines": {
94-
"node": "^18"
93+
"node": "^18.16.1"
9594
},
9695
"devDependencies": {
9796
"@testing-library/jest-dom": "^5.16.5",

0 commit comments

Comments
 (0)