@form-engine-ts/storage-azure-table 6.8.0 → 6.9.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.
- package/README.md +4 -1
- package/dist/index.cjs +6 -0
- package/dist/index.d.cts +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +7 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -43,7 +43,10 @@ owns table creation, credentials, retries, and client lifecycle.
|
|
|
43
43
|
The default codec persists the canonical `FormSubmission.values` payload and never creates an `answers` property. Set
|
|
44
44
|
`rejectLegacyAnswers: true` to fail explicitly when a legacy entity is encountered; no legacy decoding or migration is
|
|
45
45
|
performed. `idempotentSubmissions: true` enables typed `created`, `duplicate`, and `conflict` results from
|
|
46
|
-
`saveSubmission(submission)`. Pass `validateAgainstSchema: true` to re-validate against the stored schema.
|
|
46
|
+
`saveSubmission(submission)`. Pass `validateAgainstSchema: true` to re-validate against the stored schema. Pass
|
|
47
|
+
`submissionSchema`, `submissionValidator`, or `validation` to validate every submission before it is written; the same
|
|
48
|
+
source can be supplied per call as `saveSubmission(submission, { validation })`. A source can be a FormSchema, a
|
|
49
|
+
Zod-compatible object with `safeParse`, or an async validator callback.
|
|
47
50
|
|
|
48
51
|
`listTextAnswerPage` accepts either the legacy single field ID or `TextAnswerPageQueryOptions.fieldIds`. Page size counts
|
|
49
52
|
emitted text items rather than entities. Its opaque Base64 JSON cursor retains the Azure continuation token plus entity
|
package/dist/index.cjs
CHANGED
|
@@ -521,6 +521,12 @@ function createAzureTableStorage(options = {}) {
|
|
|
521
521
|
async saveSubmission(submission, saveOptions = {}) {
|
|
522
522
|
ensureWritable();
|
|
523
523
|
const stored = parseSubmission(submission, `input ${String(submission?.id)}`);
|
|
524
|
+
const explicitValidation = saveOptions.validator ?? saveOptions.validation;
|
|
525
|
+
const configuredValidation = options.submissionValidator ?? options.submissionSchema ?? options.validator ?? options.schema ?? options.validation;
|
|
526
|
+
if (explicitValidation !== void 0) await (0, import_core.assertValidFormSubmissionWith)(explicitValidation, stored);
|
|
527
|
+
if (explicitValidation === void 0 && configuredValidation !== void 0) {
|
|
528
|
+
await (0, import_core.assertValidFormSubmissionWith)(configuredValidation, stored);
|
|
529
|
+
}
|
|
524
530
|
if (options.validateSubmissions === true || saveOptions.validateAgainstSchema === true) {
|
|
525
531
|
const schema = parseSchemaEntity(
|
|
526
532
|
await (await schemaClient(stored.formId)).getEntity(stored.formId, schemaRowKey(stored.formVersion))
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FormSubmission, BaseSubmissionMetadata, PagedSubmissionStorageAdapter, SubmissionPageQueryOptions, StrictFormSubmission, SaveSubmissionOptions, SubmissionSaveResult, SubmissionFilter, JsonValue, TextAnswerPageQueryOptions, TypedTextAnswerPage } from '@form-engine-ts/core';
|
|
1
|
+
import { FormSubmission, BaseSubmissionMetadata, PagedSubmissionStorageAdapter, SubmissionPageQueryOptions, FormSubmissionValidationSource, FormSubmissionValidator, StrictFormSubmission, SaveSubmissionOptions, SubmissionSaveResult, SubmissionFilter, JsonValue, TextAnswerPageQueryOptions, TypedTextAnswerPage } from '@form-engine-ts/core';
|
|
2
2
|
|
|
3
3
|
interface AzureTableListOptions {
|
|
4
4
|
readonly queryOptions?: {
|
|
@@ -112,6 +112,13 @@ interface AzureTableStorageOptions<T = FormSubmission> {
|
|
|
112
112
|
readonly idempotency?: boolean;
|
|
113
113
|
/** Re-validate a submission against the stored FormSchema before saving. */
|
|
114
114
|
readonly validateSubmissions?: boolean;
|
|
115
|
+
/** Validate every saved submission with an application-owned schema or callback. */
|
|
116
|
+
readonly submissionSchema?: FormSubmissionValidationSource;
|
|
117
|
+
readonly submissionValidator?: FormSubmissionValidator;
|
|
118
|
+
/** Alias for `submissionValidator`/`submissionSchema`. */
|
|
119
|
+
readonly validation?: FormSubmissionValidationSource;
|
|
120
|
+
readonly validator?: FormSubmissionValidationSource;
|
|
121
|
+
readonly schema?: FormSubmissionValidationSource;
|
|
115
122
|
}
|
|
116
123
|
interface AzureTableStorageAdapter<TMeta extends BaseSubmissionMetadata = BaseSubmissionMetadata> extends PagedSubmissionStorageAdapter {
|
|
117
124
|
readonly fetchPage: (formId: string, options?: {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FormSubmission, BaseSubmissionMetadata, PagedSubmissionStorageAdapter, SubmissionPageQueryOptions, StrictFormSubmission, SaveSubmissionOptions, SubmissionSaveResult, SubmissionFilter, JsonValue, TextAnswerPageQueryOptions, TypedTextAnswerPage } from '@form-engine-ts/core';
|
|
1
|
+
import { FormSubmission, BaseSubmissionMetadata, PagedSubmissionStorageAdapter, SubmissionPageQueryOptions, FormSubmissionValidationSource, FormSubmissionValidator, StrictFormSubmission, SaveSubmissionOptions, SubmissionSaveResult, SubmissionFilter, JsonValue, TextAnswerPageQueryOptions, TypedTextAnswerPage } from '@form-engine-ts/core';
|
|
2
2
|
|
|
3
3
|
interface AzureTableListOptions {
|
|
4
4
|
readonly queryOptions?: {
|
|
@@ -112,6 +112,13 @@ interface AzureTableStorageOptions<T = FormSubmission> {
|
|
|
112
112
|
readonly idempotency?: boolean;
|
|
113
113
|
/** Re-validate a submission against the stored FormSchema before saving. */
|
|
114
114
|
readonly validateSubmissions?: boolean;
|
|
115
|
+
/** Validate every saved submission with an application-owned schema or callback. */
|
|
116
|
+
readonly submissionSchema?: FormSubmissionValidationSource;
|
|
117
|
+
readonly submissionValidator?: FormSubmissionValidator;
|
|
118
|
+
/** Alias for `submissionValidator`/`submissionSchema`. */
|
|
119
|
+
readonly validation?: FormSubmissionValidationSource;
|
|
120
|
+
readonly validator?: FormSubmissionValidationSource;
|
|
121
|
+
readonly schema?: FormSubmissionValidationSource;
|
|
115
122
|
}
|
|
116
123
|
interface AzureTableStorageAdapter<TMeta extends BaseSubmissionMetadata = BaseSubmissionMetadata> extends PagedSubmissionStorageAdapter {
|
|
117
124
|
readonly fetchPage: (formId: string, options?: {
|
package/dist/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
assertValidFormSchema,
|
|
4
4
|
assertValidFormSubmission,
|
|
5
|
+
assertValidFormSubmissionWith,
|
|
5
6
|
hashFormSubmissionPayload,
|
|
6
7
|
matchesSubmissionPageFilters,
|
|
7
8
|
normalizeSubmissionPageSize
|
|
@@ -497,6 +498,12 @@ function createAzureTableStorage(options = {}) {
|
|
|
497
498
|
async saveSubmission(submission, saveOptions = {}) {
|
|
498
499
|
ensureWritable();
|
|
499
500
|
const stored = parseSubmission(submission, `input ${String(submission?.id)}`);
|
|
501
|
+
const explicitValidation = saveOptions.validator ?? saveOptions.validation;
|
|
502
|
+
const configuredValidation = options.submissionValidator ?? options.submissionSchema ?? options.validator ?? options.schema ?? options.validation;
|
|
503
|
+
if (explicitValidation !== void 0) await assertValidFormSubmissionWith(explicitValidation, stored);
|
|
504
|
+
if (explicitValidation === void 0 && configuredValidation !== void 0) {
|
|
505
|
+
await assertValidFormSubmissionWith(configuredValidation, stored);
|
|
506
|
+
}
|
|
500
507
|
if (options.validateSubmissions === true || saveOptions.validateAgainstSchema === true) {
|
|
501
508
|
const schema = parseSchemaEntity(
|
|
502
509
|
await (await schemaClient(stored.formId)).getEntity(stored.formId, schemaRowKey(stored.formVersion))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@form-engine-ts/storage-azure-table",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.9.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"typescript"
|
|
40
40
|
],
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@form-engine-ts/core": "6.
|
|
42
|
+
"@form-engine-ts/core": "6.9.0"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"@azure/data-tables": "^13.3.2"
|