Skip to content

fix: deprecated cuid dependency & clean up CI file #359

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ env:

on:
pull_request:
branches: ['dev', 'main', 'canary']
branches: ['dev', 'main']

jobs:
build-test:
Expand All @@ -18,7 +18,6 @@ jobs:
strategy:
matrix:
node-version: [16.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v3
Expand All @@ -32,13 +31,7 @@ jobs:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- run: pnpm install --frozen-lockfile
- run: |
if [[ $GITHUB_REF == 'refs/heads/canary' ]]; then
DEFAULT_NPM_TAG=canary pnpm run build
else
DEFAULT_NPM_TAG=latest pnpm run build
fi

- run: DEFAULT_NPM_TAG=latest pnpm run build
- run: pnpm lint

# install again for internal dependencies
Expand Down
2 changes: 1 addition & 1 deletion packages/runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
"linkDirectory": true
},
"dependencies": {
"@paralleldrive/cuid2": "^2.2.0",
"@types/bcryptjs": "^2.4.2",
"@zenstackhq/sdk": "workspace:*",
"bcryptjs": "^2.4.3",
"change-case": "^4.1.2",
"colors": "1.4.0",
"cuid": "^2.1.8",
"decimal.js": "^10.4.2",
"deepcopy": "^2.1.0",
"pluralize": "^8.0.0",
Expand Down
6 changes: 3 additions & 3 deletions packages/runtime/src/enhancements/policy/policy-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import { PrismaClientKnownRequestError, PrismaClientUnknownRequestError } from '@prisma/client/runtime';
import { AUXILIARY_FIELDS, CrudFailureReason, GUARD_FIELD_NAME, TRANSACTION_FIELD_NAME } from '@zenstackhq/sdk';
import { camelCase } from 'change-case';
import cuid from 'cuid';
import deepcopy from 'deepcopy';
import pluralize from 'pluralize';
import { fromZodError } from 'zod-validation-error';
import {
AuthUser,
Expand All @@ -20,7 +20,7 @@ import { NestedWriteVisitor, VisitorContext } from '../nested-write-vistor';
import { ModelMeta, PolicyDef, PolicyFunc } from '../types';
import { enumerate, formatObject, getModelFields } from '../utils';
import { Logger } from './logger';
import pluralize from 'pluralize';
import { createId } from '@paralleldrive/cuid2';

/**
* Access policy enforcement utilities
Expand Down Expand Up @@ -400,7 +400,7 @@ export class PolicyUtil {

// use a transaction to conduct write, so in case any create or nested create
// fails access policies, we can roll back the entire operation
const transactionId = cuid();
const transactionId = createId();

// args processor for create
const processCreate = async (model: string, args: any) => {
Expand Down
6 changes: 3 additions & 3 deletions packages/schema/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
"prisma": "^4.0.0"
},
"dependencies": {
"@paralleldrive/cuid2": "^2.2.0",
"@prisma/generator-helper": "^4.0.0",
"@prisma/internals": "^4.0.0",
"@zenstackhq/language": "workspace:*",
Expand All @@ -91,7 +92,6 @@
"chevrotain": "^9.1.0",
"colors": "1.4.0",
"commander": "^8.3.0",
"cuid": "^2.1.8",
"get-latest-version": "^5.0.1",
"langium": "1.1.0",
"mixpanel": "^0.17.0",
Expand Down Expand Up @@ -122,6 +122,7 @@
"@types/vscode": "^1.56.0",
"@typescript-eslint/eslint-plugin": "^5.42.0",
"@typescript-eslint/parser": "^5.42.0",
"@vscode/vsce": "^2.19.0",
"@zenstackhq/runtime": "workspace:*",
"@zenstackhq/testtools": "workspace:*",
"concurrently": "^7.4.0",
Expand All @@ -139,7 +140,6 @@
"ts-node": "^10.9.1",
"tsc-alias": "^1.7.0",
"typescript": "^4.8.4",
"vitest": "^0.29.7",
"vsce": "^2.13.0"
"vitest": "^0.29.7"
}
}
4 changes: 2 additions & 2 deletions packages/schema/src/telemetry.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createId } from '@paralleldrive/cuid2';
import exitHook from 'async-exit-hook';
import { CommanderError } from 'commander';
import cuid from 'cuid';
import { init, Mixpanel } from 'mixpanel';
import { machineIdSync } from 'node-machine-id';
import * as os from 'os';
Expand Down Expand Up @@ -30,7 +30,7 @@ export type TelemetryEvents =
export class Telemetry {
private readonly mixpanel: Mixpanel | undefined;
private readonly hostId = machineIdSync();
private readonly sessionid = cuid();
private readonly sessionid = createId();
private readonly _os = os.platform();
private readonly version = getVersion();
private exitWait = 200;
Expand Down
Loading