@getpara/shared 1.29.0 → 1.30.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/dist/cjs/index.js +1 -0
- package/dist/cjs/schemas/permissionsV2.js +577 -6
- package/dist/cjs/schemas/permissionsV2UserParameters.js +85 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/schemas/permissionsV2.js +575 -5
- package/dist/esm/schemas/permissionsV2UserParameters.js +82 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/schemas/permissionsV2.d.ts +12646 -503
- package/dist/types/schemas/permissionsV2.d.ts.map +1 -1
- package/dist/types/schemas/permissionsV2UserParameters.d.ts +468 -0
- package/dist/types/schemas/permissionsV2UserParameters.d.ts.map +1 -0
- package/dist/types/types/partner.d.ts +2 -0
- package/dist/types/types/partner.d.ts.map +1 -1
- package/dist/types/types/pending-transaction.d.ts +2 -0
- package/dist/types/types/pending-transaction.d.ts.map +1 -1
- package/dist/types/types/permissions.d.ts +25 -2
- package/dist/types/types/permissions.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
const templateRevisionFields = {
|
|
3
|
+
policyVersion: z.string().min(1),
|
|
4
|
+
policyHash: z.string().min(1),
|
|
5
|
+
expectedRevision: z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
|
|
6
|
+
};
|
|
7
|
+
export const permissionsV2UserParameterSaveSchema = z
|
|
8
|
+
.object({
|
|
9
|
+
...templateRevisionFields,
|
|
10
|
+
values: z.record(z.string()),
|
|
11
|
+
})
|
|
12
|
+
.strict();
|
|
13
|
+
export const permissionsV2UserParameterResetSchema = z.object(templateRevisionFields).strict();
|
|
14
|
+
const storedRevision = z.number().int().positive().max(Number.MAX_SAFE_INTEGER);
|
|
15
|
+
const provenance = z.enum(['default', 'personal']);
|
|
16
|
+
const parameterDescriptor = z
|
|
17
|
+
.object({
|
|
18
|
+
id: z.string().min(1),
|
|
19
|
+
label: z.string().min(1),
|
|
20
|
+
defaultValue: z.string(),
|
|
21
|
+
fact: z.string().min(1),
|
|
22
|
+
asset: z.string().optional(),
|
|
23
|
+
window: z.string().optional(),
|
|
24
|
+
})
|
|
25
|
+
.strict();
|
|
26
|
+
const viewFields = {
|
|
27
|
+
userId: z.string().min(1),
|
|
28
|
+
partnerId: z.string().min(1),
|
|
29
|
+
appId: z.string().min(1),
|
|
30
|
+
policyId: z.string().min(1),
|
|
31
|
+
policyVersion: z.string().min(1),
|
|
32
|
+
policyHash: z.string().min(1),
|
|
33
|
+
parameters: z.array(parameterDescriptor),
|
|
34
|
+
};
|
|
35
|
+
export const permissionsV2UserParameterReadyViewSchema = z.union([
|
|
36
|
+
z
|
|
37
|
+
.object({
|
|
38
|
+
...viewFields,
|
|
39
|
+
status: z.literal('ready'),
|
|
40
|
+
revision: z.literal(0),
|
|
41
|
+
provenance: z.literal('default'),
|
|
42
|
+
values: z.record(z.string()),
|
|
43
|
+
})
|
|
44
|
+
.strict(),
|
|
45
|
+
z
|
|
46
|
+
.object({
|
|
47
|
+
...viewFields,
|
|
48
|
+
status: z.literal('ready'),
|
|
49
|
+
revision: storedRevision,
|
|
50
|
+
provenance,
|
|
51
|
+
values: z.record(z.string()),
|
|
52
|
+
configurationHash: z.string().min(1),
|
|
53
|
+
})
|
|
54
|
+
.strict(),
|
|
55
|
+
]);
|
|
56
|
+
export const permissionsV2UserParameterViewSchema = z.union([
|
|
57
|
+
permissionsV2UserParameterReadyViewSchema,
|
|
58
|
+
z
|
|
59
|
+
.object({
|
|
60
|
+
...viewFields,
|
|
61
|
+
status: z.literal('needs_confirmation'),
|
|
62
|
+
revision: storedRevision,
|
|
63
|
+
provenance,
|
|
64
|
+
previousValues: z.record(z.string()),
|
|
65
|
+
})
|
|
66
|
+
.strict(),
|
|
67
|
+
]);
|
|
68
|
+
export const permissionsV2UserParameterHistorySchema = z
|
|
69
|
+
.object({
|
|
70
|
+
revisions: z.array(z
|
|
71
|
+
.object({
|
|
72
|
+
policyVersion: z.string().min(1),
|
|
73
|
+
policyHash: z.string().min(1),
|
|
74
|
+
revision: storedRevision,
|
|
75
|
+
provenance,
|
|
76
|
+
values: z.record(z.string()),
|
|
77
|
+
changedAt: z.string().datetime(),
|
|
78
|
+
})
|
|
79
|
+
.strict()),
|
|
80
|
+
nextBeforeRevision: storedRevision.optional(),
|
|
81
|
+
})
|
|
82
|
+
.strict();
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './types/index.js';
|
|
2
2
|
export * from './types/permissions.js';
|
|
3
3
|
export * from './schemas/permissionsV2.js';
|
|
4
|
+
export * from './schemas/permissionsV2UserParameters.js';
|
|
4
5
|
export * from './utils/index.js';
|
|
5
6
|
import * as transactionTypes from './types/transaction.js';
|
|
6
7
|
export { transactionTypes };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kBAAkB,CAAC;AAEjC,OAAO,KAAK,gBAAgB,MAAM,wBAAwB,CAAC;AAE3D,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0CAA0C,CAAC;AACzD,cAAc,kBAAkB,CAAC;AAEjC,OAAO,KAAK,gBAAgB,MAAM,wBAAwB,CAAC;AAE3D,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|