@esposter/azure 2.38.1 → 2.39.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/index.d.ts +33 -38
  2. package/dist/index.js +18 -24
  3. package/package.json +12 -13
package/dist/index.d.ts CHANGED
@@ -1,9 +1,8 @@
1
1
  import { z } from "zod";
2
- import baseDayjs from "dayjs";
3
2
  import { PropertyNames } from "@esposter/shared";
4
3
  import { TableEntity } from "@azure/data-tables";
5
4
  //#region src/models/BinaryOperator.d.ts
6
- declare enum BinaryOperator {
5
+ export declare enum BinaryOperator {
7
6
  eq = "eq",
8
7
  ge = "ge",
9
8
  gt = "gt",
@@ -11,21 +10,21 @@ declare enum BinaryOperator {
11
10
  lt = "lt",
12
11
  ne = "ne"
13
12
  }
14
- declare const BinaryOperators: readonly BinaryOperator[];
13
+ export declare const BinaryOperators: readonly BinaryOperator[];
15
14
  //#endregion
16
15
  //#region src/models/search/SearchOperator.d.ts
17
- declare enum SearchOperator {
16
+ export declare enum SearchOperator {
18
17
  arrayAny = "arrayAny",
19
18
  arrayContains = "arrayContains"
20
19
  }
21
20
  //#endregion
22
21
  //#region src/models/SerializableValue.d.ts
23
- declare const SERIALIZABLE_VALUE_MAX_LENGTH = 100;
24
- type SerializableValue = boolean | Date | null | number | string;
25
- declare const serializableValueSchema: z.ZodType<SerializableValue, SerializableValue>;
22
+ export declare const SERIALIZABLE_VALUE_MAX_LENGTH = 100;
23
+ export type SerializableValue = boolean | Date | null | number | string;
24
+ export declare const serializableValueSchema: z.ZodType<SerializableValue, SerializableValue>;
26
25
  //#endregion
27
26
  //#region src/models/Clause.d.ts
28
- type Clause<T extends object> = {
27
+ export type Clause<T extends object> = {
29
28
  key: keyof T & string;
30
29
  not?: boolean;
31
30
  } & ({
@@ -39,18 +38,18 @@ type Clause<T extends object> = {
39
38
  });
40
39
  //#endregion
41
40
  //#region src/models/UnaryOperator.d.ts
42
- declare enum UnaryOperator {
41
+ export declare enum UnaryOperator {
43
42
  and = "and",
44
43
  not = "not",
45
44
  or = "or"
46
45
  }
47
46
  //#endregion
48
47
  //#region src/services/constants.d.ts
49
- declare const AZURE_MAX_BATCH_SIZE = 100;
50
- declare const AZURE_MAX_PAGE_SIZE = 1e3;
51
- declare const AZURE_MAX_QUEUE_VISIBILITY_TIMEOUT_MS: number;
48
+ export declare const AZURE_MAX_BATCH_SIZE = 100;
49
+ export declare const AZURE_MAX_PAGE_SIZE = 1e3;
50
+ export declare const AZURE_MAX_QUEUE_VISIBILITY_TIMEOUT_MS: number;
52
51
  //#endregion
53
- //#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/omit-index-signature.d.ts
52
+ //#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/omit-index-signature.d.ts
54
53
  /**
55
54
  Omit any index signatures from the given object type, leaving only explicitly defined properties.
56
55
 
@@ -145,67 +144,63 @@ type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
145
144
  type OmitIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? never : KeyType]: ObjectType[KeyType]; };
146
145
  //#endregion
147
146
  //#region src/models/table/CompositeKey.d.ts
148
- declare class CompositeKey implements OmitIndexSignature<TableEntity> {
147
+ export declare class CompositeKey implements OmitIndexSignature<TableEntity> {
149
148
  partitionKey: string;
150
149
  rowKey: string;
151
150
  }
152
- declare const CompositeKeyPropertyNames: PropertyNames<CompositeKey>;
153
- //#endregion
154
- //#region src/services/dayjs/index.d.ts
155
- declare const dayjs: typeof baseDayjs;
151
+ export declare const CompositeKeyPropertyNames: PropertyNames<CompositeKey>;
156
152
  //#endregion
157
153
  //#region src/services/search/getSearchNonNullClause.d.ts
158
- declare const getSearchNonNullClause: <T extends object>(key: keyof T & string) => Clause<T>;
154
+ export declare const getSearchNonNullClause: <T extends object>(key: keyof T & string) => Clause<T>;
159
155
  //#endregion
160
156
  //#region src/services/search/getSearchNullClause.d.ts
161
- declare const getSearchNullClause: <T extends object>(key: keyof T & string) => Clause<T>;
157
+ export declare const getSearchNullClause: <T extends object>(key: keyof T & string) => Clause<T>;
162
158
  //#endregion
163
159
  //#region src/services/table/constants.d.ts
164
- declare const KeysToCapitalize: Set<string>;
165
- declare const KeysToUncapitalize: Set<string>;
160
+ export declare const KeysToCapitalize: Set<string>;
161
+ export declare const KeysToUncapitalize: Set<string>;
166
162
  //#endregion
167
163
  //#region src/services/table/deserializeKey.d.ts
168
- declare const deserializeKey: (key: string) => string;
164
+ export declare const deserializeKey: (key: string) => string;
169
165
  //#endregion
170
166
  //#region src/services/table/getTableNullClause.d.ts
171
- declare const getTableNullClause: <T extends object>(key: keyof T & string) => Clause<T>;
167
+ export declare const getTableNullClause: <T extends object>(key: keyof T & string) => Clause<T>;
172
168
  //#endregion
173
169
  //#region src/services/table/serializeKey.d.ts
174
- declare const serializeKey: (key: string) => string;
170
+ export declare const serializeKey: (key: string) => string;
175
171
  //#endregion
176
172
  //#region src/services/transformer/constants.d.ts
177
- declare const CLAUSE_REGEX: RegExp;
173
+ export declare const CLAUSE_REGEX: RegExp;
178
174
  //#endregion
179
175
  //#region src/services/transformer/deserializeClause.d.ts
180
- declare const deserializeClause: (string: string) => Extract<Clause<Record<string, unknown>>, {
176
+ export declare const deserializeClause: (serializedClause: string) => Extract<Clause<Record<string, unknown>>, {
181
177
  operator: BinaryOperator;
182
178
  }>;
183
179
  //#endregion
184
180
  //#region src/services/transformer/deserializeValue.d.ts
185
- declare const deserializeValue: (string: string) => SerializableValue;
181
+ export declare const deserializeValue: (serializedValue: string) => SerializableValue;
186
182
  //#endregion
187
183
  //#region src/services/transformer/escapeValue.d.ts
188
- declare const escapeValue: (value: string) => string;
184
+ export declare const escapeValue: (value: string) => string;
189
185
  //#endregion
190
186
  //#region src/services/transformer/getPartitionKeyFilter.d.ts
191
- declare const getPartitionKeyFilter: (partitionKey: CompositeKey["partitionKey"]) => string;
187
+ export declare const getPartitionKeyFilter: (partitionKey: CompositeKey["partitionKey"]) => string;
192
188
  //#endregion
193
189
  //#region src/services/transformer/RangeOperators.d.ts
194
- declare const RangeOperators: (BinaryOperator | SearchOperator)[];
190
+ export declare const RangeOperators: (BinaryOperator | SearchOperator)[];
195
191
  //#endregion
196
192
  //#region src/services/transformer/serializeClause.d.ts
197
- declare const serializeClause: (clause: Clause<Record<string, unknown>>, isTableFilter?: boolean) => string;
193
+ export declare const serializeClause: (clause: Clause<Record<string, unknown>>, isTableFilter?: boolean) => string;
198
194
  //#endregion
199
195
  //#region src/services/transformer/serializeClauses.d.ts
200
- declare const serializeClauses: (clauses: Clause<Record<string, unknown>>[]) => string;
196
+ export declare const serializeClauses: (clauses: Clause<Record<string, unknown>>[]) => string;
201
197
  //#endregion
202
198
  //#region src/services/transformer/serializeClausesCore.d.ts
203
- declare const serializeClausesCore: (clauses: Clause<Record<string, unknown>>[], isTableFilter: boolean) => string;
199
+ export declare const serializeClausesCore: (clauses: Clause<Record<string, unknown>>[], isTableFilter: boolean) => string;
204
200
  //#endregion
205
201
  //#region src/services/transformer/serializeSearchClauses.d.ts
206
- declare const serializeSearchClauses: (clauses: Clause<Record<string, unknown>>[]) => string;
202
+ export declare const serializeSearchClauses: (clauses: Clause<Record<string, unknown>>[]) => string;
207
203
  //#endregion
208
204
  //#region src/services/transformer/serializeValue.d.ts
209
- declare const serializeValue: (value: SerializableValue, isTableFilter?: boolean) => string;
210
- //#endregion
211
- export { AZURE_MAX_BATCH_SIZE, AZURE_MAX_PAGE_SIZE, AZURE_MAX_QUEUE_VISIBILITY_TIMEOUT_MS, BinaryOperator, BinaryOperators, CLAUSE_REGEX, Clause, CompositeKey, CompositeKeyPropertyNames, KeysToCapitalize, KeysToUncapitalize, RangeOperators, SERIALIZABLE_VALUE_MAX_LENGTH, SearchOperator, SerializableValue, UnaryOperator, dayjs, deserializeClause, deserializeKey, deserializeValue, escapeValue, getPartitionKeyFilter, getSearchNonNullClause, getSearchNullClause, getTableNullClause, serializableValueSchema, serializeClause, serializeClauses, serializeClausesCore, serializeKey, serializeSearchClauses, serializeValue };
205
+ export declare const serializeValue: (value: SerializableValue, isTableFilter?: boolean) => string;
206
+ //#endregion
package/dist/index.js CHANGED
@@ -1,6 +1,4 @@
1
1
  import { z } from "zod";
2
- import baseDayjs from "dayjs";
3
- import duration from "dayjs/plugin/duration.js";
4
2
  import { ID_SEPARATOR, InvalidOperationError, NotFoundError, Operation, capitalize, getPropertyNames, normalizeString, takeOne, uncapitalize } from "@esposter/shared";
5
3
  //#region src/models/BinaryOperator.ts
6
4
  let BinaryOperator = /* @__PURE__ */ function(BinaryOperator) {
@@ -32,14 +30,10 @@ let UnaryOperator = /* @__PURE__ */ function(UnaryOperator) {
32
30
  return UnaryOperator;
33
31
  }({});
34
32
  //#endregion
35
- //#region src/services/dayjs/index.ts
36
- baseDayjs.extend(duration);
37
- const dayjs = baseDayjs;
38
- //#endregion
39
33
  //#region src/services/constants.ts
40
34
  const AZURE_MAX_BATCH_SIZE = 100;
41
35
  const AZURE_MAX_PAGE_SIZE = 1e3;
42
- const AZURE_MAX_QUEUE_VISIBILITY_TIMEOUT_MS = dayjs.duration(7, "days").asMilliseconds();
36
+ const AZURE_MAX_QUEUE_VISIBILITY_TIMEOUT_MS = Temporal.Duration.from({ days: 7 }).total("milliseconds");
43
37
  //#endregion
44
38
  //#region src/models/search/SearchOperator.ts
45
39
  let SearchOperator = /* @__PURE__ */ function(SearchOperator) {
@@ -98,28 +92,28 @@ const VALUE_REGEX = [
98
92
  const CLAUSE_REGEX = new RegExp(String.raw`^(?<not>not\s+)?(?<key>[A-Za-z0-9_]*)\s*(?<operator>${BinaryOperators.join(ID_SEPARATOR)})\s+(?<value>${VALUE_REGEX})$`, "iu");
99
93
  //#endregion
100
94
  //#region src/services/transformer/deserializeValue.ts
101
- const deserializeValue = (string) => {
102
- if (string === String(true)) return true;
103
- else if (string === String(false)) return false;
104
- else if (string === String(null)) return null;
105
- else if (Number.isFinite(Number(string))) return Number(string);
106
- else if (string === String(NaN)) return NaN;
107
- else if (string.startsWith("datetime'") && string.endsWith("'")) return new Date(string.slice(9, -1));
108
- else if (string.startsWith("'") && string.endsWith("'")) return string.slice(1, -1).replaceAll("''", "'");
95
+ const deserializeValue = (serializedValue) => {
96
+ if (serializedValue === String(true)) return true;
97
+ else if (serializedValue === String(false)) return false;
98
+ else if (serializedValue === String(null)) return null;
99
+ else if (Number.isFinite(Number(serializedValue))) return Number(serializedValue);
100
+ else if (serializedValue === String(NaN)) return NaN;
101
+ else if (serializedValue.startsWith("datetime'") && serializedValue.endsWith("'")) return new Date(serializedValue.slice(9, -1));
102
+ else if (serializedValue.startsWith("'") && serializedValue.endsWith("'")) return serializedValue.slice(1, -1).replaceAll("''", "'");
109
103
  else {
110
- const date = new Date(string);
111
- if (Number.isNaN(date)) return string;
104
+ const date = new Date(serializedValue);
105
+ if (Number.isNaN(date)) return serializedValue;
112
106
  else return date;
113
107
  }
114
108
  };
115
109
  //#endregion
116
110
  //#region src/services/transformer/deserializeClause.ts
117
- const deserializeClause = (string) => {
118
- const normalizedString = normalizeString(string);
119
- const match = CLAUSE_REGEX.exec(normalizedString);
120
- if (!match) throw new NotFoundError(deserializeClause.name, normalizedString);
111
+ const deserializeClause = (serializedClause) => {
112
+ const normalizedClause = normalizeString(serializedClause);
113
+ const match = CLAUSE_REGEX.exec(normalizedClause);
114
+ if (!match) throw new NotFoundError(deserializeClause.name, normalizedClause);
121
115
  const groups = match.groups;
122
- if (!groups) throw new NotFoundError(deserializeClause.name, normalizedString);
116
+ if (!groups) throw new NotFoundError(deserializeClause.name, normalizedClause);
123
117
  return {
124
118
  key: deserializeKey(groups.key),
125
119
  not: Boolean(groups.not),
@@ -172,7 +166,7 @@ const serializeClausesCore = (clauses, isTableFilter) => {
172
166
  const groupedStrings = [];
173
167
  for (const clauseGroup of Object.values(groupedClauses)) if (clauseGroup.length === 1) groupedStrings.push(serializeClause(takeOne(clauseGroup), isTableFilter));
174
168
  else {
175
- const serializedClauses = clauseGroup.map((c) => serializeClause(c, isTableFilter));
169
+ const serializedClauses = clauseGroup.map((clause) => serializeClause(clause, isTableFilter));
176
170
  const groupedString = clauseGroup.some(({ operator }) => RangeOperators.includes(operator)) ? serializedClauses.join(` and `) : `(${serializedClauses.join(` or `)})`;
177
171
  groupedStrings.push(groupedString);
178
172
  }
@@ -192,4 +186,4 @@ const getPartitionKeyFilter = (partitionKey) => serializeClauses([{
192
186
  //#region src/services/transformer/serializeSearchClauses.ts
193
187
  const serializeSearchClauses = (clauses) => serializeClausesCore(clauses, false);
194
188
  //#endregion
195
- export { AZURE_MAX_BATCH_SIZE, AZURE_MAX_PAGE_SIZE, AZURE_MAX_QUEUE_VISIBILITY_TIMEOUT_MS, BinaryOperator, BinaryOperators, CLAUSE_REGEX, CompositeKey, CompositeKeyPropertyNames, KeysToCapitalize, KeysToUncapitalize, RangeOperators, SERIALIZABLE_VALUE_MAX_LENGTH, SearchOperator, UnaryOperator, dayjs, deserializeClause, deserializeKey, deserializeValue, escapeValue, getPartitionKeyFilter, getSearchNonNullClause, getSearchNullClause, getTableNullClause, serializableValueSchema, serializeClause, serializeClauses, serializeClausesCore, serializeKey, serializeSearchClauses, serializeValue };
189
+ export { AZURE_MAX_BATCH_SIZE, AZURE_MAX_PAGE_SIZE, AZURE_MAX_QUEUE_VISIBILITY_TIMEOUT_MS, BinaryOperator, BinaryOperators, CLAUSE_REGEX, CompositeKey, CompositeKeyPropertyNames, KeysToCapitalize, KeysToUncapitalize, RangeOperators, SERIALIZABLE_VALUE_MAX_LENGTH, SearchOperator, UnaryOperator, deserializeClause, deserializeKey, deserializeValue, escapeValue, getPartitionKeyFilter, getSearchNonNullClause, getSearchNullClause, getTableNullClause, serializableValueSchema, serializeClause, serializeClauses, serializeClausesCore, serializeKey, serializeSearchClauses, serializeValue };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@esposter/azure",
3
- "version": "2.38.1",
3
+ "version": "2.39.0",
4
4
  "description": "The Azure wire conventions Esposter's clients and its mocks both speak — OData filter clauses, entity key casing, and service limits.",
5
5
  "keywords": [
6
6
  "azure",
@@ -24,6 +24,7 @@
24
24
  "dist"
25
25
  ],
26
26
  "type": "module",
27
+ "sideEffects": false,
27
28
  "types": "dist/index.d.ts",
28
29
  "imports": {
29
30
  "#src/*": "./src/*.ts"
@@ -36,34 +37,32 @@
36
37
  "access": "public"
37
38
  },
38
39
  "scripts": {
39
- "build": "pnpm export:gen && tsdown",
40
- "export:gen": "ctix build --config ../configuration/.ctirc-ts",
40
+ "build": "tsdown",
41
+ "export:gen": "generate-exports",
41
42
  "format": "oxfmt",
42
43
  "format:check": "oxfmt --check",
43
44
  "lint": "eslint .",
44
45
  "lint:fix": "eslint --fix .",
45
46
  "test": "vitest",
46
- "typecheck": "tsgo"
47
+ "typecheck": "tsc"
47
48
  },
48
49
  "dependencies": {
49
- "@esposter/shared": "2.38.1",
50
- "dayjs": "^1.11.23"
50
+ "@esposter/shared": "2.39.0"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@arethetypeswrong/core": "^0.18.5",
54
- "@esposter/configuration": "2.38.1",
55
- "ctix": "^2.8.2",
54
+ "@esposter/configuration": "2.39.0",
56
55
  "publint": "^0.3.24",
57
- "tsdown": "^0.22.14",
58
- "type-fest": "^5.8.0",
56
+ "tsdown": "^0.23.0",
57
+ "type-fest": "^5.9.0",
59
58
  "vitest": "^4.1.11"
60
59
  },
61
60
  "peerDependencies": {
62
61
  "@azure/data-tables": "^13.3.2",
63
- "zod": "^4.4.3"
62
+ "zod": "^4.5.4"
64
63
  },
65
64
  "inlinedDependencies": {
66
- "type-fest": "5.8.0"
65
+ "type-fest": "5.9.0"
67
66
  },
68
- "gitHead": "b4c56347a01ac26a5e447c934a0c3c3308161bb5"
67
+ "gitHead": "98f89a176510bb274865731121f990e48c6d056a"
69
68
  }