Skip to content
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

feat: tree-shakable zod #423

Merged
merged 1 commit into from
Jan 13, 2025
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
2 changes: 1 addition & 1 deletion scripts/i18n.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const generateTypes = async () => {
)
.join('\n\n');

const schema = `import { z } from 'zod';
const schema = `import * as z from 'zod';

${schemas}

Expand Down
2 changes: 1 addition & 1 deletion src/types/blob.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {z} from 'zod';
import * as z from 'zod';

export const IcrcBlobSchema = z.string().refine(
(val) => {
Expand Down
2 changes: 1 addition & 1 deletion src/types/i18n.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Auto-generated definitions file ("npm run i18n")
import {z} from 'zod';
import * as z from 'zod';

export const i18nCoreSchema = z
.object({
Expand Down
2 changes: 1 addition & 1 deletion src/types/icrc-accounts.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {z} from 'zod';
import * as z from 'zod';
import {base64ToUint8Array} from '../utils/base64.utils';
import {IcrcBlobSchema} from './blob';
import {PrincipalTextSchema} from './principal';
Expand Down
2 changes: 1 addition & 1 deletion src/types/icrc-requests.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {isNullish} from '@dfinity/utils';
import {z} from 'zod';
import * as z from 'zod';
import {
ICRC25_PERMISSIONS,
ICRC25_REQUEST_PERMISSIONS,
Expand Down
2 changes: 1 addition & 1 deletion src/types/icrc-responses.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {z} from 'zod';
import * as z from 'zod';
import {IcrcBlobSchema} from './blob';
import {IcrcAccountsSchema} from './icrc-accounts';
import {
Expand Down
2 changes: 1 addition & 1 deletion src/types/icrc-standards.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {z} from 'zod';
import * as z from 'zod';
import {
ICRC21,
ICRC21_CALL_CONSENT_MESSAGE,
Expand Down
2 changes: 1 addition & 1 deletion src/types/post-message.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {z} from 'zod';
import * as z from 'zod';
import {UrlSchema} from './url';

export const OriginSchema = UrlSchema;
Expand Down
2 changes: 1 addition & 1 deletion src/types/principal.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Principal} from '@dfinity/principal';
import {z} from 'zod';
import * as z from 'zod';

export const PrincipalTextSchema = z.string().refine(
(principal) => {
Expand Down
2 changes: 1 addition & 1 deletion src/types/relying-party-options.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {z} from 'zod';
import * as z from 'zod';
import {UrlSchema} from './url';

const ConnectionOptionsSchema = z.object({
Expand Down
2 changes: 1 addition & 1 deletion src/types/relying-party-requests.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {z} from 'zod';
import * as z from 'zod';
import {RpcIdSchema} from './rpc';

export const RelyingPartyRequestOptionsTimeoutSchema = z.object({
Expand Down
2 changes: 1 addition & 1 deletion src/types/relying-party.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {z} from 'zod';
import * as z from 'zod';
import {IcrcScopesSchema, IcrcSupportedStandardsSchema} from './icrc-responses';

const RelyingPartyMessageEventDataSchema = z
Expand Down
2 changes: 1 addition & 1 deletion src/types/rpc.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {z} from 'zod';
import * as z from 'zod';
import {
JSON_RPC_VERSION_2,
RpcErrorCode,
Expand Down
2 changes: 1 addition & 1 deletion src/types/rpc.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {z} from 'zod';
import * as z from 'zod';

// JSON-RPC 2.0 Specification
// https://www.jsonrpc.org/specification
Expand Down
2 changes: 1 addition & 1 deletion src/types/signer-handlers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {z} from 'zod';
import * as z from 'zod';
import {RpcIdSchema} from './rpc';

const NotifySchema = z.object({
Expand Down
2 changes: 1 addition & 1 deletion src/types/signer-options.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {type Identity} from '@dfinity/agent';
import {isNullish} from '@dfinity/utils';
import {z} from 'zod';
import * as z from 'zod';
import {UrlSchema} from './url';

const IdentitySchema = z.custom<Identity>((value: unknown): boolean => {
Expand Down
2 changes: 1 addition & 1 deletion src/types/signer-prompts.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {z} from 'zod';
import * as z from 'zod';
import {
ICRC21_CALL_CONSENT_MESSAGE,
ICRC25_REQUEST_PERMISSIONS,
Expand Down
2 changes: 1 addition & 1 deletion src/types/signer-sessions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {z} from 'zod';
import * as z from 'zod';
import {IcrcScopeSchema} from './icrc-responses';

export const SessionTimestampsSchema = z.object({
Expand Down
2 changes: 1 addition & 1 deletion src/types/signer.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {z} from 'zod';
import * as z from 'zod';
import {
IcrcAccountsRequestSchema,
IcrcPermissionsRequestSchema,
Expand Down
2 changes: 1 addition & 1 deletion src/types/url.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {z} from 'zod';
import * as z from 'zod';

export const UrlSchema = z
.string()
Expand Down
Loading