diff --git a/oclif.manifest.json b/oclif.manifest.json index ee18e43e6..790e81773 100644 --- a/oclif.manifest.json +++ b/oclif.manifest.json @@ -1,5 +1,5 @@ { - "version": "5.21.0", + "version": "5.21.1", "commands": { "authCommand": { "id": "authCommand", diff --git a/package.json b/package.json index 1207c9703..f323d61e5 100644 --- a/package.json +++ b/package.json @@ -119,14 +119,14 @@ } }, "scripts": { - "build": "shx rm -rf dist && tsc -b && oclif manifest && oclif readme --multi", + "build": "shx rm -rf dist && tsc -b && oclif manifest", "build:tar": "oclif pack tarballs", "format": "prettier --write \"src/**/*.{ts,js,json}\" \"test/**/*.{ts,js,json}\" \"test-utils/**/*.{ts,js,json}\" \"*.{ts,js,json,md}\"", "format:check": "prettier --check \"src/**/*.{ts,js,json}\" \"test/**/*.{ts,js,json}\" \"test-utils/**/*.{ts,js,json}\" \"*.{ts,js,json,md}\"", "lint": "eslint . --config eslint.config.mjs", "postpack": "shx rm -f oclif.manifest.json", "posttest": "yarn lint", - "prepack": "yarn build && oclif manifest && oclif readme --multi", + "prepack": "yarn build && oclif readme --multi", "pretest": "yarn format:check", "test": "mocha test/*.ts \"src/**/*.test.ts\"", "test:ci": "yarn test --forbid-only", diff --git a/src/api/zodClient.ts b/src/api/zodClient.ts index 46a8258dd..f48ae197a 100644 --- a/src/api/zodClient.ts +++ b/src/api/zodClient.ts @@ -188,13 +188,35 @@ const AllFilter = z.object({ type: z.literal('all').default('all') }) const OptInFilter = z.object({ type: z.literal('optIn').default('optIn') }) const UserFilter = z.object({ subType: z.enum(['user_id', 'email', 'platform', 'deviceModel']), - comparator: z.enum(['=', '!=', 'exist', '!exist', 'contain', '!contain']), + comparator: z.enum([ + '=', + '!=', + 'exist', + '!exist', + 'contain', + '!contain', + 'startWith', + '!startWith', + 'endWith', + '!endWith', + ]), values: z.array(z.string()).optional(), type: z.literal('user').default('user'), }) const UserCountryFilter = z.object({ subType: z.literal('country').default('country'), - comparator: z.enum(['=', '!=', 'exist', '!exist', 'contain', '!contain']), + comparator: z.enum([ + '=', + '!=', + 'exist', + '!exist', + 'contain', + '!contain', + 'startWith', + '!startWith', + 'endWith', + '!endWith', + ]), values: z.array(z.string()), type: z.literal('user').default('user'), }) @@ -222,6 +244,10 @@ const UserCustomFilter = z.object({ '!exist', 'contain', '!contain', + 'startWith', + '!startWith', + 'endWith', + '!endWith', ]), dataKey: z.string().min(1), dataKeyType: z.enum(['String', 'Boolean', 'Number']), diff --git a/src/commands/generate/types.test.ts b/src/commands/generate/types.test.ts index a61a6e3d1..f14045426 100644 --- a/src/commands/generate/types.test.ts +++ b/src/commands/generate/types.test.ts @@ -3,7 +3,7 @@ import { BASE_URL } from '../../api/common' import { dvcTest, setCurrentTestFile } from '../../../test-utils' import { jestSnapshotPlugin } from 'mocha-chai-jest-snapshot' import * as fs from 'fs' -import chai from 'chai' +import * as chai from 'chai' import Nock, { Body, ReplyHeaders } from 'nock' const mockVariablesResponse = [ diff --git a/src/commands/targeting/update.test.ts b/src/commands/targeting/update.test.ts index 5f2bf2423..d829ad707 100644 --- a/src/commands/targeting/update.test.ts +++ b/src/commands/targeting/update.test.ts @@ -2,7 +2,7 @@ import { expect } from '@oclif/test' import { dvcTest, setCurrentTestFile } from '../../../test-utils' import { BASE_URL } from '../../api/common' import { jestSnapshotPlugin } from 'mocha-chai-jest-snapshot' -import chai from 'chai' +import * as chai from 'chai' import inquirer from 'inquirer' describe('targeting update', () => { diff --git a/src/ui/prompts/targetingPrompts.ts b/src/ui/prompts/targetingPrompts.ts index f1f7004bb..52bb28c76 100644 --- a/src/ui/prompts/targetingPrompts.ts +++ b/src/ui/prompts/targetingPrompts.ts @@ -9,7 +9,22 @@ export const comparatorChoices = (input: Record) => { } else if (input.subType === 'audienceMatch') { return ['=', '!='] } - return ['=', '!=', 'exist', '!exist', 'contain', '!contain'] + return [ + '=', + '!=', + '>', + '>=', + '<', + '<=', + 'exist', + '!exist', + 'contain', + '!contain', + 'startWith', + '!startWith', + 'endWith', + '!endWith', + ] } export const targetingStatusPrompt = { diff --git a/src/ui/targetingTree.ts b/src/ui/targetingTree.ts index b5cf3b510..679cc96a7 100644 --- a/src/ui/targetingTree.ts +++ b/src/ui/targetingTree.ts @@ -35,14 +35,18 @@ const subTypeMap = { const comparatorMap = { '=': 'is', '!=': 'is not', - contain: 'contains', - '!contain': 'does not contain', - exist: 'exists', - '!exist': 'does not exist', '>': 'is greater than', '>=': 'is greater than or equal to', '<': 'is less than', '<=': 'is less than or equal to', + contain: 'contains', + '!contain': 'does not contain', + startWith: 'starts with', + '!startWith': 'does not start with', + endWith: 'ends with', + '!endWith': 'does not end with', + exist: 'exists', + '!exist': 'does not exist', } export const renderTargetingTree = (