@palantir/pack.document-schema.model-types 0.1.0-beta.3 → 0.1.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/.turbo/turbo-lint.log +2 -2
- package/.turbo/turbo-transpileBrowser.log +1 -1
- package/.turbo/turbo-transpileCjs.log +1 -1
- package/.turbo/turbo-transpileEsm.log +1 -1
- package/.turbo/turbo-transpileTypes.log +1 -1
- package/.turbo/turbo-typecheck.log +1 -1
- package/CHANGELOG.md +17 -0
- package/build/browser/index.js +15 -1
- package/build/browser/index.js.map +1 -1
- package/build/cjs/index.cjs +16 -0
- package/build/cjs/index.cjs.map +1 -1
- package/build/cjs/index.d.cts +106 -41
- package/build/esm/index.js +15 -1
- package/build/esm/index.js.map +1 -1
- package/build/types/index.d.ts +6 -2
- package/build/types/index.d.ts.map +1 -1
- package/build/types/types/ActivityEvent.d.ts +27 -0
- package/build/types/types/ActivityEvent.d.ts.map +1 -0
- package/build/types/types/DocumentRef.d.ts +14 -5
- package/build/types/types/DocumentRef.d.ts.map +1 -1
- package/build/types/types/Model.d.ts +4 -0
- package/build/types/types/Model.d.ts.map +1 -1
- package/build/types/types/PresenceEvent.d.ts +30 -0
- package/build/types/types/PresenceEvent.d.ts.map +1 -0
- package/package.json +5 -5
- package/src/index.ts +19 -2
- package/src/types/ActivityEvent.ts +51 -0
- package/src/types/DocumentRef.ts +26 -8
- package/src/types/Model.ts +5 -0
- package/src/types/PresenceEvent.ts +59 -0
package/.turbo/turbo-lint.log
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
|
|
2
|
-
> @palantir/pack.document-schema.model-types@0.1.0
|
|
3
|
-
> eslint ./src
|
|
2
|
+
> @palantir/pack.document-schema.model-types@0.1.0 lint /home/runner/work/pack/pack/packages/document-schema/model-types
|
|
3
|
+
> eslint ./src && dprint check --config $(find-up dprint.json) --allow-no-files
|
|
4
4
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @palantir/pack.document-schema.model-types@0.1.0
|
|
2
|
+
> @palantir/pack.document-schema.model-types@0.1.0 transpileBrowser /home/runner/work/pack/pack/packages/document-schema/model-types
|
|
3
3
|
> monorepo-transpile -f esm -m bundle -t browser
|
|
4
4
|
|
|
5
5
|
👍
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @palantir/pack.document-schema.model-types@0.1.0
|
|
2
|
+
> @palantir/pack.document-schema.model-types@0.1.0 transpileCjs /home/runner/work/pack/pack/packages/document-schema/model-types
|
|
3
3
|
> monorepo-transpile -f cjs -m bundle -t node
|
|
4
4
|
|
|
5
5
|
👍
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @palantir/pack.document-schema.model-types@0.1.0
|
|
2
|
+
> @palantir/pack.document-schema.model-types@0.1.0 transpileEsm /home/runner/work/pack/pack/packages/document-schema/model-types
|
|
3
3
|
> monorepo-transpile -f esm -m bundle -t node
|
|
4
4
|
|
|
5
5
|
👍
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @palantir/pack.document-schema.model-types@0.1.0
|
|
2
|
+
> @palantir/pack.document-schema.model-types@0.1.0 transpileTypes /home/runner/work/pack/pack/packages/document-schema/model-types
|
|
3
3
|
> monorepo-transpile -f esm -m types -t node
|
|
4
4
|
|
|
5
5
|
👍
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
|
|
2
|
-
> @palantir/pack.document-schema.model-types@0.1.0
|
|
2
|
+
> @palantir/pack.document-schema.model-types@0.1.0 typecheck /home/runner/work/pack/pack/packages/document-schema/model-types
|
|
3
3
|
> tsc --noEmit --emitDeclarationOnly false
|
|
4
4
|
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @palantir/pack.document-schema.model-types
|
|
2
2
|
|
|
3
|
+
## 0.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 77c07c4: Add Core and State Core packages, add Refs to core model types
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- 09f7acd: Add activity & presence custom event subscriptions
|
|
12
|
+
- 99d9186: Add doc transactions for grouping multiple edits, and include an optional edit description for activity/history
|
|
13
|
+
- 27a3b33: Initial release
|
|
14
|
+
- 511ee0c: Resetting to beta version of package
|
|
15
|
+
- Updated dependencies [8698373]
|
|
16
|
+
- Updated dependencies [77c07c4]
|
|
17
|
+
- Updated dependencies [3ebc927]
|
|
18
|
+
- @palantir/pack.core@0.1.0
|
|
19
|
+
|
|
3
20
|
## 0.1.0-beta.3
|
|
4
21
|
|
|
5
22
|
### Minor Changes
|
package/build/browser/index.js
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
// src/types/ActivityEvent.ts
|
|
2
|
+
var ActivityEventDataType = {
|
|
3
|
+
CUSTOM_EVENT: "customEvent",
|
|
4
|
+
UNKNOWN: "unknown"
|
|
5
|
+
};
|
|
6
|
+
|
|
1
7
|
// src/types/DocumentRef.ts
|
|
2
8
|
var DocumentRefBrand = Symbol("pack:DocumentRef");
|
|
3
9
|
|
|
@@ -25,6 +31,14 @@ var ExternalRefType = {
|
|
|
25
31
|
// src/types/ObjectRef.ts
|
|
26
32
|
var ObjectRefBrand = Symbol("pack:ObjectRef");
|
|
27
33
|
|
|
34
|
+
// src/types/PresenceEvent.ts
|
|
35
|
+
var PresenceEventDataType = {
|
|
36
|
+
ARRIVED: "presenceArrived",
|
|
37
|
+
DEPARTED: "presenceDeparted",
|
|
38
|
+
CUSTOM_EVENT: "customEvent",
|
|
39
|
+
UNKNOWN: "unknown"
|
|
40
|
+
};
|
|
41
|
+
|
|
28
42
|
// src/types/RecordCollectionRef.ts
|
|
29
43
|
var RecordCollectionRefBrand = Symbol("pack:RecordCollectionRef");
|
|
30
44
|
|
|
@@ -34,6 +48,6 @@ var RecordRefBrand = Symbol("pack:RecordRef");
|
|
|
34
48
|
// src/types/UserRef.ts
|
|
35
49
|
var UserRefBrand = Symbol("pack:UserRef");
|
|
36
50
|
|
|
37
|
-
export { DocumentRefBrand, ExternalRefType, MediaRefBrand, Metadata, ObjectRefBrand, RecordCollectionRefBrand, RecordRefBrand, UserRefBrand, getMetadata };
|
|
51
|
+
export { ActivityEventDataType, DocumentRefBrand, ExternalRefType, MediaRefBrand, Metadata, ObjectRefBrand, PresenceEventDataType, RecordCollectionRefBrand, RecordRefBrand, UserRefBrand, getMetadata };
|
|
38
52
|
//# sourceMappingURL=index.js.map
|
|
39
53
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/types/DocumentRef.ts","../../src/types/MediaRef.ts","../../src/types/Metadata.ts","../../src/types/Model.ts","../../src/types/ObjectRef.ts","../../src/types/RecordCollectionRef.ts","../../src/types/RecordRef.ts","../../src/types/UserRef.ts"],"names":[],"mappings":";AAgBO,IAAM,gBAAA,GAAmB,OAAO,kBAAkB;;;ACAlD,IAAM,aAAA,GAAgB,OAAO,eAAe;;;ACA5C,IAAM,QAAA,GAAW,OAAO,yCAAyC;AACjE,SAAS,YAAY,GAAA,EAAK;AAE/B,EAAA,MAAM,QAAA,GAAW,IAAI,QAAQ,CAAA;AAC7B,EAAA,IAAI,YAAY,IAAA,EAAM;AACpB,IAAA,MAAM,IAAI,MAAM,+BAA+B,CAAA;AAAA,EACjD;AACA,EAAA,OAAO,QAAA;AACT;;;ACDO,IAAM,eAAA,GAAkB;AAAA,EAC7B,OAAA,EAAS,QAAA;AAAA,EACT,SAAA,EAAW,UAAA;AAAA,EACX,UAAA,EAAY,WAAA;AAAA,EACZ,QAAA,EAAU;AACZ;;;ACZO,IAAM,cAAA,GAAiB,OAAO,gBAAgB;;;ACA9C,IAAM,wBAAA,GAA2B,OAAO,0BAA0B;;;ACAlE,IAAM,cAAA,GAAiB,OAAO,gBAAgB;;;ACA9C,IAAM,YAAA,GAAe,OAAO,cAAc","file":"index.js","sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const DocumentRefBrand = Symbol(\"pack:DocumentRef\");","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const MediaRefBrand = Symbol(\"pack:MediaRef\");\n\n/**\n * @experimental\n */","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const Metadata = Symbol(\"@palantir/pack.document-schema/metadata\");\nexport function getMetadata(obj) {\n // TS always treats symbol keys as optional\n const metadata = obj[Metadata];\n if (metadata == null) {\n throw new Error(\"Object does not have metadata\");\n }\n return metadata;\n}","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * A Model defines the structure of a document record or union.\n *\n * It includes a zod schema for validation and type information.\n */\n// TODO: I think we can/should hide the zod types\n\nexport const ExternalRefType = {\n DOC_REF: \"docRef\",\n MEDIA_REF: \"mediaRef\",\n OBJECT_REF: \"objectRef\",\n USER_REF: \"userRef\"\n};","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const ObjectRefBrand = Symbol(\"pack:ObjectRef\");\n\n/**\n * @experimental\n */","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const RecordCollectionRefBrand = Symbol(\"pack:RecordCollectionRef\");","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const RecordRefBrand = Symbol(\"pack:RecordRef\");","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const UserRefBrand = Symbol(\"pack:UserRef\");"]}
|
|
1
|
+
{"version":3,"sources":["../../src/types/ActivityEvent.ts","../../src/types/DocumentRef.ts","../../src/types/MediaRef.ts","../../src/types/Metadata.ts","../../src/types/Model.ts","../../src/types/ObjectRef.ts","../../src/types/PresenceEvent.ts","../../src/types/RecordCollectionRef.ts","../../src/types/RecordRef.ts","../../src/types/UserRef.ts"],"names":[],"mappings":";AAgBO,IAAM,qBAAA,GAAwB;AAAA,EACnC,YAAA,EAAc,aAAA;AAAA,EACd,OAAA,EAAS;AACX;;;ACHO,IAAM,gBAAA,GAAmB,OAAO,kBAAkB;;;ACAlD,IAAM,aAAA,GAAgB,OAAO,eAAe;;;ACA5C,IAAM,QAAA,GAAW,OAAO,yCAAyC;AACjE,SAAS,YAAY,GAAA,EAAK;AAE/B,EAAA,MAAM,QAAA,GAAW,IAAI,QAAQ,CAAA;AAC7B,EAAA,IAAI,YAAY,IAAA,EAAM;AACpB,IAAA,MAAM,IAAI,MAAM,+BAA+B,CAAA;AAAA,EACjD;AACA,EAAA,OAAO,QAAA;AACT;;;ACDO,IAAM,eAAA,GAAkB;AAAA,EAC7B,OAAA,EAAS,QAAA;AAAA,EACT,SAAA,EAAW,UAAA;AAAA,EACX,UAAA,EAAY,WAAA;AAAA,EACZ,QAAA,EAAU;AACZ;;;ACZO,IAAM,cAAA,GAAiB,OAAO,gBAAgB;;;ACA9C,IAAM,qBAAA,GAAwB;AAAA,EACnC,OAAA,EAAS,iBAAA;AAAA,EACT,QAAA,EAAU,kBAAA;AAAA,EACV,YAAA,EAAc,aAAA;AAAA,EACd,OAAA,EAAS;AACX;;;ACLO,IAAM,wBAAA,GAA2B,OAAO,0BAA0B;;;ACAlE,IAAM,cAAA,GAAiB,OAAO,gBAAgB;;;ACA9C,IAAM,YAAA,GAAe,OAAO,cAAc","file":"index.js","sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const ActivityEventDataType = {\n CUSTOM_EVENT: \"customEvent\",\n UNKNOWN: \"unknown\"\n};\n\n// TODO: add standard document activity events (need to be added to api types)","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const DocumentRefBrand = Symbol(\"pack:DocumentRef\");","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const MediaRefBrand = Symbol(\"pack:MediaRef\");\n\n/**\n * @experimental\n */","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const Metadata = Symbol(\"@palantir/pack.document-schema/metadata\");\nexport function getMetadata(obj) {\n // TS always treats symbol keys as optional\n const metadata = obj[Metadata];\n if (metadata == null) {\n throw new Error(\"Object does not have metadata\");\n }\n return metadata;\n}","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * A Model defines the structure of a document record or union.\n *\n * It includes a zod schema for validation and type information.\n */\n// TODO: I think we can/should hide the zod types\n\nexport const ExternalRefType = {\n DOC_REF: \"docRef\",\n MEDIA_REF: \"mediaRef\",\n OBJECT_REF: \"objectRef\",\n USER_REF: \"userRef\"\n};","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const ObjectRefBrand = Symbol(\"pack:ObjectRef\");\n\n/**\n * @experimental\n */","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const PresenceEventDataType = {\n ARRIVED: \"presenceArrived\",\n DEPARTED: \"presenceDeparted\",\n CUSTOM_EVENT: \"customEvent\",\n UNKNOWN: \"unknown\"\n};","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const RecordCollectionRefBrand = Symbol(\"pack:RecordCollectionRef\");","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const RecordRefBrand = Symbol(\"pack:RecordRef\");","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const UserRefBrand = Symbol(\"pack:UserRef\");"]}
|
package/build/cjs/index.cjs
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
// src/types/ActivityEvent.ts
|
|
4
|
+
var ActivityEventDataType = {
|
|
5
|
+
CUSTOM_EVENT: "customEvent",
|
|
6
|
+
UNKNOWN: "unknown"
|
|
7
|
+
};
|
|
8
|
+
|
|
3
9
|
// src/types/DocumentRef.ts
|
|
4
10
|
var DocumentRefBrand = Symbol("pack:DocumentRef");
|
|
5
11
|
|
|
@@ -27,6 +33,14 @@ var ExternalRefType = {
|
|
|
27
33
|
// src/types/ObjectRef.ts
|
|
28
34
|
var ObjectRefBrand = Symbol("pack:ObjectRef");
|
|
29
35
|
|
|
36
|
+
// src/types/PresenceEvent.ts
|
|
37
|
+
var PresenceEventDataType = {
|
|
38
|
+
ARRIVED: "presenceArrived",
|
|
39
|
+
DEPARTED: "presenceDeparted",
|
|
40
|
+
CUSTOM_EVENT: "customEvent",
|
|
41
|
+
UNKNOWN: "unknown"
|
|
42
|
+
};
|
|
43
|
+
|
|
30
44
|
// src/types/RecordCollectionRef.ts
|
|
31
45
|
var RecordCollectionRefBrand = Symbol("pack:RecordCollectionRef");
|
|
32
46
|
|
|
@@ -36,11 +50,13 @@ var RecordRefBrand = Symbol("pack:RecordRef");
|
|
|
36
50
|
// src/types/UserRef.ts
|
|
37
51
|
var UserRefBrand = Symbol("pack:UserRef");
|
|
38
52
|
|
|
53
|
+
exports.ActivityEventDataType = ActivityEventDataType;
|
|
39
54
|
exports.DocumentRefBrand = DocumentRefBrand;
|
|
40
55
|
exports.ExternalRefType = ExternalRefType;
|
|
41
56
|
exports.MediaRefBrand = MediaRefBrand;
|
|
42
57
|
exports.Metadata = Metadata;
|
|
43
58
|
exports.ObjectRefBrand = ObjectRefBrand;
|
|
59
|
+
exports.PresenceEventDataType = PresenceEventDataType;
|
|
44
60
|
exports.RecordCollectionRefBrand = RecordCollectionRefBrand;
|
|
45
61
|
exports.RecordRefBrand = RecordRefBrand;
|
|
46
62
|
exports.UserRefBrand = UserRefBrand;
|
package/build/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/types/DocumentRef.ts","../../src/types/MediaRef.ts","../../src/types/Metadata.ts","../../src/types/Model.ts","../../src/types/ObjectRef.ts","../../src/types/RecordCollectionRef.ts","../../src/types/RecordRef.ts","../../src/types/UserRef.ts"],"names":[],"mappings":";;;AAgBO,IAAM,gBAAA,GAAmB,OAAO,kBAAkB;;;ACAlD,IAAM,aAAA,GAAgB,OAAO,eAAe;;;ACA5C,IAAM,QAAA,GAAW,OAAO,yCAAyC;AACjE,SAAS,YAAY,GAAA,EAAK;AAE/B,EAAA,MAAM,QAAA,GAAW,IAAI,QAAQ,CAAA;AAC7B,EAAA,IAAI,YAAY,IAAA,EAAM;AACpB,IAAA,MAAM,IAAI,MAAM,+BAA+B,CAAA;AAAA,EACjD;AACA,EAAA,OAAO,QAAA;AACT;;;ACDO,IAAM,eAAA,GAAkB;AAAA,EAC7B,OAAA,EAAS,QAAA;AAAA,EACT,SAAA,EAAW,UAAA;AAAA,EACX,UAAA,EAAY,WAAA;AAAA,EACZ,QAAA,EAAU;AACZ;;;ACZO,IAAM,cAAA,GAAiB,OAAO,gBAAgB;;;ACA9C,IAAM,wBAAA,GAA2B,OAAO,0BAA0B;;;ACAlE,IAAM,cAAA,GAAiB,OAAO,gBAAgB;;;ACA9C,IAAM,YAAA,GAAe,OAAO,cAAc","file":"index.cjs","sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const DocumentRefBrand = Symbol(\"pack:DocumentRef\");","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const MediaRefBrand = Symbol(\"pack:MediaRef\");\n\n/**\n * @experimental\n */","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const Metadata = Symbol(\"@palantir/pack.document-schema/metadata\");\nexport function getMetadata(obj) {\n // TS always treats symbol keys as optional\n const metadata = obj[Metadata];\n if (metadata == null) {\n throw new Error(\"Object does not have metadata\");\n }\n return metadata;\n}","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * A Model defines the structure of a document record or union.\n *\n * It includes a zod schema for validation and type information.\n */\n// TODO: I think we can/should hide the zod types\n\nexport const ExternalRefType = {\n DOC_REF: \"docRef\",\n MEDIA_REF: \"mediaRef\",\n OBJECT_REF: \"objectRef\",\n USER_REF: \"userRef\"\n};","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const ObjectRefBrand = Symbol(\"pack:ObjectRef\");\n\n/**\n * @experimental\n */","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const RecordCollectionRefBrand = Symbol(\"pack:RecordCollectionRef\");","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const RecordRefBrand = Symbol(\"pack:RecordRef\");","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const UserRefBrand = Symbol(\"pack:UserRef\");"]}
|
|
1
|
+
{"version":3,"sources":["../../src/types/ActivityEvent.ts","../../src/types/DocumentRef.ts","../../src/types/MediaRef.ts","../../src/types/Metadata.ts","../../src/types/Model.ts","../../src/types/ObjectRef.ts","../../src/types/PresenceEvent.ts","../../src/types/RecordCollectionRef.ts","../../src/types/RecordRef.ts","../../src/types/UserRef.ts"],"names":[],"mappings":";;;AAgBO,IAAM,qBAAA,GAAwB;AAAA,EACnC,YAAA,EAAc,aAAA;AAAA,EACd,OAAA,EAAS;AACX;;;ACHO,IAAM,gBAAA,GAAmB,OAAO,kBAAkB;;;ACAlD,IAAM,aAAA,GAAgB,OAAO,eAAe;;;ACA5C,IAAM,QAAA,GAAW,OAAO,yCAAyC;AACjE,SAAS,YAAY,GAAA,EAAK;AAE/B,EAAA,MAAM,QAAA,GAAW,IAAI,QAAQ,CAAA;AAC7B,EAAA,IAAI,YAAY,IAAA,EAAM;AACpB,IAAA,MAAM,IAAI,MAAM,+BAA+B,CAAA;AAAA,EACjD;AACA,EAAA,OAAO,QAAA;AACT;;;ACDO,IAAM,eAAA,GAAkB;AAAA,EAC7B,OAAA,EAAS,QAAA;AAAA,EACT,SAAA,EAAW,UAAA;AAAA,EACX,UAAA,EAAY,WAAA;AAAA,EACZ,QAAA,EAAU;AACZ;;;ACZO,IAAM,cAAA,GAAiB,OAAO,gBAAgB;;;ACA9C,IAAM,qBAAA,GAAwB;AAAA,EACnC,OAAA,EAAS,iBAAA;AAAA,EACT,QAAA,EAAU,kBAAA;AAAA,EACV,YAAA,EAAc,aAAA;AAAA,EACd,OAAA,EAAS;AACX;;;ACLO,IAAM,wBAAA,GAA2B,OAAO,0BAA0B;;;ACAlE,IAAM,cAAA,GAAiB,OAAO,gBAAgB;;;ACA9C,IAAM,YAAA,GAAe,OAAO,cAAc","file":"index.cjs","sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const ActivityEventDataType = {\n CUSTOM_EVENT: \"customEvent\",\n UNKNOWN: \"unknown\"\n};\n\n// TODO: add standard document activity events (need to be added to api types)","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const DocumentRefBrand = Symbol(\"pack:DocumentRef\");","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const MediaRefBrand = Symbol(\"pack:MediaRef\");\n\n/**\n * @experimental\n */","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const Metadata = Symbol(\"@palantir/pack.document-schema/metadata\");\nexport function getMetadata(obj) {\n // TS always treats symbol keys as optional\n const metadata = obj[Metadata];\n if (metadata == null) {\n throw new Error(\"Object does not have metadata\");\n }\n return metadata;\n}","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * A Model defines the structure of a document record or union.\n *\n * It includes a zod schema for validation and type information.\n */\n// TODO: I think we can/should hide the zod types\n\nexport const ExternalRefType = {\n DOC_REF: \"docRef\",\n MEDIA_REF: \"mediaRef\",\n OBJECT_REF: \"objectRef\",\n USER_REF: \"userRef\"\n};","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const ObjectRefBrand = Symbol(\"pack:ObjectRef\");\n\n/**\n * @experimental\n */","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const PresenceEventDataType = {\n ARRIVED: \"presenceArrived\",\n DEPARTED: \"presenceDeparted\",\n CUSTOM_EVENT: \"customEvent\",\n UNKNOWN: \"unknown\"\n};","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const RecordCollectionRefBrand = Symbol(\"pack:RecordCollectionRef\");","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const RecordRefBrand = Symbol(\"pack:RecordRef\");","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const UserRefBrand = Symbol(\"pack:UserRef\");"]}
|
package/build/cjs/index.d.cts
CHANGED
|
@@ -1,6 +1,71 @@
|
|
|
1
1
|
import { Flavored } from '@palantir/pack.core';
|
|
2
2
|
import { ZodType } from 'zod';
|
|
3
3
|
|
|
4
|
+
declare const Metadata: symbol;
|
|
5
|
+
interface WithMetadata<T> {
|
|
6
|
+
readonly [Metadata]: T;
|
|
7
|
+
}
|
|
8
|
+
declare function getMetadata<T>(obj: WithMetadata<T>): T;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* A Model defines the structure of a document record or union.
|
|
12
|
+
*
|
|
13
|
+
* It includes a zod schema for validation and type information.
|
|
14
|
+
*/
|
|
15
|
+
interface Model<T = unknown, Z extends ZodType<T> = ZodType<T>> extends WithMetadata<ModelMetadata<T>> {
|
|
16
|
+
readonly __type: T;
|
|
17
|
+
readonly zodSchema: Readonly<Z>;
|
|
18
|
+
}
|
|
19
|
+
type ModelData<M extends Model> = M["__type"];
|
|
20
|
+
interface EditDescription<M extends Model = Model> {
|
|
21
|
+
readonly data: ModelData<M>;
|
|
22
|
+
readonly model: M;
|
|
23
|
+
}
|
|
24
|
+
declare const ExternalRefType: {
|
|
25
|
+
readonly DOC_REF: "docRef";
|
|
26
|
+
readonly MEDIA_REF: "mediaRef";
|
|
27
|
+
readonly OBJECT_REF: "objectRef";
|
|
28
|
+
readonly USER_REF: "userRef";
|
|
29
|
+
};
|
|
30
|
+
type ExternalRefType = typeof ExternalRefType[keyof typeof ExternalRefType];
|
|
31
|
+
interface ModelMetadata<T = unknown> {
|
|
32
|
+
readonly externalRefFieldTypes?: Readonly<Record<keyof T, ExternalRefType>>;
|
|
33
|
+
readonly name: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
type UserId = Flavored<"pack:UserId">;
|
|
37
|
+
declare const UserRefBrand: unique symbol;
|
|
38
|
+
interface UserRef {
|
|
39
|
+
readonly userId: UserId;
|
|
40
|
+
readonly [UserRefBrand]: typeof UserRefBrand;
|
|
41
|
+
readonly get: (force?: boolean) => Promise<unknown>;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
type ActivityEventId = Flavored<"pack:EventId">;
|
|
45
|
+
declare const ActivityEventDataType: {
|
|
46
|
+
readonly CUSTOM_EVENT: "customEvent";
|
|
47
|
+
readonly UNKNOWN: "unknown";
|
|
48
|
+
};
|
|
49
|
+
interface ActivityEventDataCustom<M extends Model = Model> {
|
|
50
|
+
readonly type: typeof ActivityEventDataType.CUSTOM_EVENT;
|
|
51
|
+
readonly model: M;
|
|
52
|
+
readonly eventData: ModelData<M>;
|
|
53
|
+
}
|
|
54
|
+
interface ActivityEventDataUnknown {
|
|
55
|
+
readonly type: "unknown";
|
|
56
|
+
readonly rawType: string;
|
|
57
|
+
readonly rawData: unknown;
|
|
58
|
+
}
|
|
59
|
+
type ActivityEventData = ActivityEventDataCustom | ActivityEventDataUnknown;
|
|
60
|
+
interface ActivityEvent {
|
|
61
|
+
readonly aggregationKey: string;
|
|
62
|
+
readonly createdBy: UserId;
|
|
63
|
+
readonly createdInstant: number;
|
|
64
|
+
readonly eventData: ActivityEventData;
|
|
65
|
+
readonly eventId: ActivityEventId;
|
|
66
|
+
readonly isRead: boolean;
|
|
67
|
+
}
|
|
68
|
+
|
|
4
69
|
interface DiscretionaryPrincipal_All {
|
|
5
70
|
"all": Record<string, never>;
|
|
6
71
|
"type": "all";
|
|
@@ -31,34 +96,6 @@ interface DocumentMetadata {
|
|
|
31
96
|
};
|
|
32
97
|
}
|
|
33
98
|
|
|
34
|
-
declare const Metadata: symbol;
|
|
35
|
-
interface WithMetadata<T> {
|
|
36
|
-
readonly [Metadata]: T;
|
|
37
|
-
}
|
|
38
|
-
declare function getMetadata<T>(obj: WithMetadata<T>): T;
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* A Model defines the structure of a document record or union.
|
|
42
|
-
*
|
|
43
|
-
* It includes a zod schema for validation and type information.
|
|
44
|
-
*/
|
|
45
|
-
interface Model<T = unknown, Z extends ZodType<T> = ZodType<T>> extends WithMetadata<ModelMetadata<T>> {
|
|
46
|
-
readonly __type: T;
|
|
47
|
-
readonly zodSchema: Readonly<Z>;
|
|
48
|
-
}
|
|
49
|
-
type ModelData<M extends Model> = M["__type"];
|
|
50
|
-
declare const ExternalRefType: {
|
|
51
|
-
readonly DOC_REF: "docRef";
|
|
52
|
-
readonly MEDIA_REF: "mediaRef";
|
|
53
|
-
readonly OBJECT_REF: "objectRef";
|
|
54
|
-
readonly USER_REF: "userRef";
|
|
55
|
-
};
|
|
56
|
-
type ExternalRefType = typeof ExternalRefType[keyof typeof ExternalRefType];
|
|
57
|
-
interface ModelMetadata<T = unknown> {
|
|
58
|
-
readonly externalRefFieldTypes?: Readonly<Record<keyof T, ExternalRefType>>;
|
|
59
|
-
readonly name: string;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
99
|
interface DocumentSchema extends WithMetadata<DocumentSchemaMetadata> {
|
|
63
100
|
readonly [modelName: string]: Model;
|
|
64
101
|
}
|
|
@@ -71,6 +108,35 @@ interface DocumentSchemaMetadata {
|
|
|
71
108
|
readonly version: number;
|
|
72
109
|
}
|
|
73
110
|
|
|
111
|
+
declare const PresenceEventDataType: {
|
|
112
|
+
readonly ARRIVED: "presenceArrived";
|
|
113
|
+
readonly DEPARTED: "presenceDeparted";
|
|
114
|
+
readonly CUSTOM_EVENT: "customEvent";
|
|
115
|
+
readonly UNKNOWN: "unknown";
|
|
116
|
+
};
|
|
117
|
+
type PresenceEventDataType = typeof PresenceEventDataType[keyof typeof PresenceEventDataType];
|
|
118
|
+
interface PresenceEventDataArrived {
|
|
119
|
+
readonly type: typeof PresenceEventDataType.ARRIVED;
|
|
120
|
+
}
|
|
121
|
+
interface PresenceEventDataDeparted {
|
|
122
|
+
readonly type: typeof PresenceEventDataType.DEPARTED;
|
|
123
|
+
}
|
|
124
|
+
interface PresenceEventDataCustom<M extends Model = Model> {
|
|
125
|
+
readonly type: typeof PresenceEventDataType.CUSTOM_EVENT;
|
|
126
|
+
readonly eventData: ModelData<M>;
|
|
127
|
+
readonly model: M;
|
|
128
|
+
}
|
|
129
|
+
interface PresenceEventUnknown {
|
|
130
|
+
readonly type: "unknown";
|
|
131
|
+
readonly rawType: string;
|
|
132
|
+
readonly rawData: unknown;
|
|
133
|
+
}
|
|
134
|
+
type PresenceEventData = PresenceEventDataArrived | PresenceEventDataDeparted | PresenceEventDataCustom | PresenceEventUnknown;
|
|
135
|
+
interface PresenceEvent {
|
|
136
|
+
readonly userId: UserId;
|
|
137
|
+
readonly eventData: PresenceEventData;
|
|
138
|
+
}
|
|
139
|
+
|
|
74
140
|
type Unsubscribe = () => void;
|
|
75
141
|
|
|
76
142
|
type RecordId = Flavored<"RecordId">;
|
|
@@ -103,15 +169,22 @@ interface RecordCollectionRef<M extends Model = Model> {
|
|
|
103
169
|
}
|
|
104
170
|
|
|
105
171
|
type DocumentId = Flavored<"DocumentId">;
|
|
172
|
+
interface PresenceSubscriptionOptions {
|
|
173
|
+
readonly ignoreSelfUpdates?: boolean;
|
|
174
|
+
}
|
|
106
175
|
declare const DocumentRefBrand: unique symbol;
|
|
107
176
|
interface DocumentRef<D extends DocumentSchema = DocumentSchema> {
|
|
108
177
|
readonly id: DocumentId;
|
|
109
178
|
readonly schema: D;
|
|
110
179
|
readonly [DocumentRefBrand]: typeof DocumentRefBrand;
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
180
|
+
getDocSnapshot(): Promise<DocumentState<D>>;
|
|
181
|
+
getRecords<R extends Model>(model: R): RecordCollectionRef<R>;
|
|
182
|
+
onActivity(callback: (docRef: DocumentRef<D>, event: ActivityEvent) => void): Unsubscribe;
|
|
183
|
+
onMetadataChange(callback: (docRef: DocumentRef<D>, metadata: DocumentMetadata) => void): Unsubscribe;
|
|
184
|
+
onPresence(callback: (docRef: DocumentRef<D>, event: PresenceEvent) => void, options?: PresenceSubscriptionOptions): Unsubscribe;
|
|
185
|
+
onStateChange(callback: (docRef: DocumentRef<D>) => void): Unsubscribe;
|
|
186
|
+
updateCustomPresence<M extends Model = Model>(model: M, eventData: ModelData<M>): void;
|
|
187
|
+
withTransaction(fn: () => void, description?: EditDescription): void;
|
|
115
188
|
}
|
|
116
189
|
|
|
117
190
|
type MediaId = Flavored<"MediaId">;
|
|
@@ -136,12 +209,4 @@ interface ObjectRef {
|
|
|
136
209
|
readonly subscribe?: (callback: unknown) => unknown;
|
|
137
210
|
}
|
|
138
211
|
|
|
139
|
-
type UserId
|
|
140
|
-
declare const UserRefBrand: unique symbol;
|
|
141
|
-
interface UserRef {
|
|
142
|
-
readonly userId: UserId;
|
|
143
|
-
readonly [UserRefBrand]: typeof UserRefBrand;
|
|
144
|
-
readonly get: (force?: boolean) => Promise<unknown>;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
export { type DiscretionaryPrincipal, type DiscretionaryPrincipal_All, type DiscretionaryPrincipal_GroupId, type DiscretionaryPrincipal_UserId, type DocumentId, type DocumentMetadata, type DocumentRef, DocumentRefBrand, type DocumentSchema, type DocumentSchemaMetadata, type DocumentState, ExternalRefType, type MediaId, type MediaRef, MediaRefBrand, Metadata, type Model, type ModelData, type ModelMetadata, type ObjectId, type ObjectRef, ObjectRefBrand, type RecordCollectionRef, RecordCollectionRefBrand, type RecordId, type RecordRef, RecordRefBrand, type Unsubscribe, type UserId, type UserRef, UserRefBrand, type WithMetadata, getMetadata };
|
|
212
|
+
export { type ActivityEvent, type ActivityEventData, type ActivityEventDataCustom, ActivityEventDataType, type ActivityEventDataUnknown, type ActivityEventId, type DiscretionaryPrincipal, type DiscretionaryPrincipal_All, type DiscretionaryPrincipal_GroupId, type DiscretionaryPrincipal_UserId, type DocumentId, type DocumentMetadata, type DocumentRef, DocumentRefBrand, type DocumentSchema, type DocumentSchemaMetadata, type DocumentState, type EditDescription, ExternalRefType, type MediaId, type MediaRef, MediaRefBrand, Metadata, type Model, type ModelData, type ModelMetadata, type ObjectId, type ObjectRef, ObjectRefBrand, type PresenceEvent, type PresenceEventData, type PresenceEventDataArrived, type PresenceEventDataCustom, type PresenceEventDataDeparted, PresenceEventDataType, type PresenceEventUnknown, type PresenceSubscriptionOptions, type RecordCollectionRef, RecordCollectionRefBrand, type RecordId, type RecordRef, RecordRefBrand, type Unsubscribe, type UserId, type UserRef, UserRefBrand, type WithMetadata, getMetadata };
|
package/build/esm/index.js
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
// src/types/ActivityEvent.ts
|
|
2
|
+
var ActivityEventDataType = {
|
|
3
|
+
CUSTOM_EVENT: "customEvent",
|
|
4
|
+
UNKNOWN: "unknown"
|
|
5
|
+
};
|
|
6
|
+
|
|
1
7
|
// src/types/DocumentRef.ts
|
|
2
8
|
var DocumentRefBrand = Symbol("pack:DocumentRef");
|
|
3
9
|
|
|
@@ -25,6 +31,14 @@ var ExternalRefType = {
|
|
|
25
31
|
// src/types/ObjectRef.ts
|
|
26
32
|
var ObjectRefBrand = Symbol("pack:ObjectRef");
|
|
27
33
|
|
|
34
|
+
// src/types/PresenceEvent.ts
|
|
35
|
+
var PresenceEventDataType = {
|
|
36
|
+
ARRIVED: "presenceArrived",
|
|
37
|
+
DEPARTED: "presenceDeparted",
|
|
38
|
+
CUSTOM_EVENT: "customEvent",
|
|
39
|
+
UNKNOWN: "unknown"
|
|
40
|
+
};
|
|
41
|
+
|
|
28
42
|
// src/types/RecordCollectionRef.ts
|
|
29
43
|
var RecordCollectionRefBrand = Symbol("pack:RecordCollectionRef");
|
|
30
44
|
|
|
@@ -34,6 +48,6 @@ var RecordRefBrand = Symbol("pack:RecordRef");
|
|
|
34
48
|
// src/types/UserRef.ts
|
|
35
49
|
var UserRefBrand = Symbol("pack:UserRef");
|
|
36
50
|
|
|
37
|
-
export { DocumentRefBrand, ExternalRefType, MediaRefBrand, Metadata, ObjectRefBrand, RecordCollectionRefBrand, RecordRefBrand, UserRefBrand, getMetadata };
|
|
51
|
+
export { ActivityEventDataType, DocumentRefBrand, ExternalRefType, MediaRefBrand, Metadata, ObjectRefBrand, PresenceEventDataType, RecordCollectionRefBrand, RecordRefBrand, UserRefBrand, getMetadata };
|
|
38
52
|
//# sourceMappingURL=index.js.map
|
|
39
53
|
//# sourceMappingURL=index.js.map
|
package/build/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/types/DocumentRef.ts","../../src/types/MediaRef.ts","../../src/types/Metadata.ts","../../src/types/Model.ts","../../src/types/ObjectRef.ts","../../src/types/RecordCollectionRef.ts","../../src/types/RecordRef.ts","../../src/types/UserRef.ts"],"names":[],"mappings":";AAgBO,IAAM,gBAAA,GAAmB,OAAO,kBAAkB;;;ACAlD,IAAM,aAAA,GAAgB,OAAO,eAAe;;;ACA5C,IAAM,QAAA,GAAW,OAAO,yCAAyC;AACjE,SAAS,YAAY,GAAA,EAAK;AAE/B,EAAA,MAAM,QAAA,GAAW,IAAI,QAAQ,CAAA;AAC7B,EAAA,IAAI,YAAY,IAAA,EAAM;AACpB,IAAA,MAAM,IAAI,MAAM,+BAA+B,CAAA;AAAA,EACjD;AACA,EAAA,OAAO,QAAA;AACT;;;ACDO,IAAM,eAAA,GAAkB;AAAA,EAC7B,OAAA,EAAS,QAAA;AAAA,EACT,SAAA,EAAW,UAAA;AAAA,EACX,UAAA,EAAY,WAAA;AAAA,EACZ,QAAA,EAAU;AACZ;;;ACZO,IAAM,cAAA,GAAiB,OAAO,gBAAgB;;;ACA9C,IAAM,wBAAA,GAA2B,OAAO,0BAA0B;;;ACAlE,IAAM,cAAA,GAAiB,OAAO,gBAAgB;;;ACA9C,IAAM,YAAA,GAAe,OAAO,cAAc","file":"index.js","sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const DocumentRefBrand = Symbol(\"pack:DocumentRef\");","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const MediaRefBrand = Symbol(\"pack:MediaRef\");\n\n/**\n * @experimental\n */","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const Metadata = Symbol(\"@palantir/pack.document-schema/metadata\");\nexport function getMetadata(obj) {\n // TS always treats symbol keys as optional\n const metadata = obj[Metadata];\n if (metadata == null) {\n throw new Error(\"Object does not have metadata\");\n }\n return metadata;\n}","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * A Model defines the structure of a document record or union.\n *\n * It includes a zod schema for validation and type information.\n */\n// TODO: I think we can/should hide the zod types\n\nexport const ExternalRefType = {\n DOC_REF: \"docRef\",\n MEDIA_REF: \"mediaRef\",\n OBJECT_REF: \"objectRef\",\n USER_REF: \"userRef\"\n};","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const ObjectRefBrand = Symbol(\"pack:ObjectRef\");\n\n/**\n * @experimental\n */","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const RecordCollectionRefBrand = Symbol(\"pack:RecordCollectionRef\");","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const RecordRefBrand = Symbol(\"pack:RecordRef\");","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const UserRefBrand = Symbol(\"pack:UserRef\");"]}
|
|
1
|
+
{"version":3,"sources":["../../src/types/ActivityEvent.ts","../../src/types/DocumentRef.ts","../../src/types/MediaRef.ts","../../src/types/Metadata.ts","../../src/types/Model.ts","../../src/types/ObjectRef.ts","../../src/types/PresenceEvent.ts","../../src/types/RecordCollectionRef.ts","../../src/types/RecordRef.ts","../../src/types/UserRef.ts"],"names":[],"mappings":";AAgBO,IAAM,qBAAA,GAAwB;AAAA,EACnC,YAAA,EAAc,aAAA;AAAA,EACd,OAAA,EAAS;AACX;;;ACHO,IAAM,gBAAA,GAAmB,OAAO,kBAAkB;;;ACAlD,IAAM,aAAA,GAAgB,OAAO,eAAe;;;ACA5C,IAAM,QAAA,GAAW,OAAO,yCAAyC;AACjE,SAAS,YAAY,GAAA,EAAK;AAE/B,EAAA,MAAM,QAAA,GAAW,IAAI,QAAQ,CAAA;AAC7B,EAAA,IAAI,YAAY,IAAA,EAAM;AACpB,IAAA,MAAM,IAAI,MAAM,+BAA+B,CAAA;AAAA,EACjD;AACA,EAAA,OAAO,QAAA;AACT;;;ACDO,IAAM,eAAA,GAAkB;AAAA,EAC7B,OAAA,EAAS,QAAA;AAAA,EACT,SAAA,EAAW,UAAA;AAAA,EACX,UAAA,EAAY,WAAA;AAAA,EACZ,QAAA,EAAU;AACZ;;;ACZO,IAAM,cAAA,GAAiB,OAAO,gBAAgB;;;ACA9C,IAAM,qBAAA,GAAwB;AAAA,EACnC,OAAA,EAAS,iBAAA;AAAA,EACT,QAAA,EAAU,kBAAA;AAAA,EACV,YAAA,EAAc,aAAA;AAAA,EACd,OAAA,EAAS;AACX;;;ACLO,IAAM,wBAAA,GAA2B,OAAO,0BAA0B;;;ACAlE,IAAM,cAAA,GAAiB,OAAO,gBAAgB;;;ACA9C,IAAM,YAAA,GAAe,OAAO,cAAc","file":"index.js","sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const ActivityEventDataType = {\n CUSTOM_EVENT: \"customEvent\",\n UNKNOWN: \"unknown\"\n};\n\n// TODO: add standard document activity events (need to be added to api types)","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const DocumentRefBrand = Symbol(\"pack:DocumentRef\");","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const MediaRefBrand = Symbol(\"pack:MediaRef\");\n\n/**\n * @experimental\n */","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const Metadata = Symbol(\"@palantir/pack.document-schema/metadata\");\nexport function getMetadata(obj) {\n // TS always treats symbol keys as optional\n const metadata = obj[Metadata];\n if (metadata == null) {\n throw new Error(\"Object does not have metadata\");\n }\n return metadata;\n}","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * A Model defines the structure of a document record or union.\n *\n * It includes a zod schema for validation and type information.\n */\n// TODO: I think we can/should hide the zod types\n\nexport const ExternalRefType = {\n DOC_REF: \"docRef\",\n MEDIA_REF: \"mediaRef\",\n OBJECT_REF: \"objectRef\",\n USER_REF: \"userRef\"\n};","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const ObjectRefBrand = Symbol(\"pack:ObjectRef\");\n\n/**\n * @experimental\n */","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const PresenceEventDataType = {\n ARRIVED: \"presenceArrived\",\n DEPARTED: \"presenceDeparted\",\n CUSTOM_EVENT: \"customEvent\",\n UNKNOWN: \"unknown\"\n};","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const RecordCollectionRefBrand = Symbol(\"pack:RecordCollectionRef\");","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const RecordRefBrand = Symbol(\"pack:RecordRef\");","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const UserRefBrand = Symbol(\"pack:UserRef\");"]}
|
package/build/types/index.d.ts
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
|
+
export { ActivityEventDataType } from "./types/ActivityEvent.js";
|
|
2
|
+
export type { ActivityEvent, ActivityEventData, ActivityEventDataCustom, ActivityEventDataUnknown, ActivityEventId } from "./types/ActivityEvent.js";
|
|
1
3
|
export type { DiscretionaryPrincipal, DiscretionaryPrincipal_All, DiscretionaryPrincipal_GroupId, DiscretionaryPrincipal_UserId, DocumentMetadata } from "./types/DocumentMetadata.js";
|
|
2
4
|
export { DocumentRefBrand } from "./types/DocumentRef.js";
|
|
3
|
-
export type { DocumentId, DocumentRef } from "./types/DocumentRef.js";
|
|
5
|
+
export type { DocumentId, DocumentRef, PresenceSubscriptionOptions } from "./types/DocumentRef.js";
|
|
4
6
|
export type { DocumentSchema, DocumentSchemaMetadata, DocumentState } from "./types/DocumentSchema.js";
|
|
5
7
|
export { MediaRefBrand } from "./types/MediaRef.js";
|
|
6
8
|
export type { MediaId, MediaRef } from "./types/MediaRef.js";
|
|
7
9
|
export { getMetadata, Metadata } from "./types/Metadata.js";
|
|
8
10
|
export type { WithMetadata } from "./types/Metadata.js";
|
|
9
11
|
export { ExternalRefType } from "./types/Model.js";
|
|
10
|
-
export type { Model, ModelData, ModelMetadata } from "./types/Model.js";
|
|
12
|
+
export type { EditDescription, Model, ModelData, ModelMetadata } from "./types/Model.js";
|
|
11
13
|
export { ObjectRefBrand } from "./types/ObjectRef.js";
|
|
12
14
|
export type { ObjectId, ObjectRef } from "./types/ObjectRef.js";
|
|
15
|
+
export { PresenceEventDataType } from "./types/PresenceEvent.js";
|
|
16
|
+
export type { PresenceEvent, PresenceEventData, PresenceEventDataArrived, PresenceEventDataCustom, PresenceEventDataDeparted, PresenceEventUnknown } from "./types/PresenceEvent.js";
|
|
13
17
|
export { RecordCollectionRefBrand } from "./types/RecordCollectionRef.js";
|
|
14
18
|
export type { RecordCollectionRef } from "./types/RecordCollectionRef.js";
|
|
15
19
|
export { RecordRefBrand } from "./types/RecordRef.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAgBA,cACE,wBACA,4BACA,gCACA,+BACA,wBACK;AACP,SAAS,wBAAwB;AACjC,cAAc,YAAY,
|
|
1
|
+
{"mappings":"AAgBA,SAAS,6BAA6B;AACtC,cACE,eACA,mBACA,yBACA,0BACA,uBACK;AACP,cACE,wBACA,4BACA,gCACA,+BACA,wBACK;AACP,SAAS,wBAAwB;AACjC,cAAc,YAAY,aAAa,mCAAmC;AAC1E,cACE,gBACA,wBACA,qBACK;AACP,SAAS,qBAAqB;AAC9B,cAAc,SAAS,gBAAgB;AACvC,SAAS,aAAa,gBAAgB;AACtC,cAAc,oBAAoB;AAClC,SAAS,uBAAuB;AAChC,cAAc,iBAAiB,OAAO,WAAW,qBAAqB;AACtE,SAAS,sBAAsB;AAC/B,cAAc,UAAU,iBAAiB;AACzC,SAAS,6BAA6B;AACtC,cACE,eACA,mBACA,0BACA,yBACA,2BACA,4BACK;AACP,SAAS,gCAAgC;AACzC,cAAc,2BAA2B;AACzC,SAAS,sBAAsB;AAC/B,cAAc,UAAU,iBAAiB;AACzC,cAAc,mBAAmB;AACjC,SAAS,oBAAoB;AAC7B,cAAc,QAAQ,eAAe","names":[],"sources":["../../src/index.ts"],"version":3,"file":"index.d.ts"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Flavored } from "@palantir/pack.core";
|
|
2
|
+
import type { Model, ModelData } from "./Model.js";
|
|
3
|
+
import type { UserId } from "./UserRef.js";
|
|
4
|
+
export type ActivityEventId = Flavored<"pack:EventId">;
|
|
5
|
+
export declare const ActivityEventDataType: {
|
|
6
|
+
readonly CUSTOM_EVENT: "customEvent";
|
|
7
|
+
readonly UNKNOWN: "unknown";
|
|
8
|
+
};
|
|
9
|
+
export interface ActivityEventDataCustom<M extends Model = Model> {
|
|
10
|
+
readonly type: typeof ActivityEventDataType.CUSTOM_EVENT;
|
|
11
|
+
readonly model: M;
|
|
12
|
+
readonly eventData: ModelData<M>;
|
|
13
|
+
}
|
|
14
|
+
export interface ActivityEventDataUnknown {
|
|
15
|
+
readonly type: "unknown";
|
|
16
|
+
readonly rawType: string;
|
|
17
|
+
readonly rawData: unknown;
|
|
18
|
+
}
|
|
19
|
+
export type ActivityEventData = ActivityEventDataCustom | ActivityEventDataUnknown;
|
|
20
|
+
export interface ActivityEvent {
|
|
21
|
+
readonly aggregationKey: string;
|
|
22
|
+
readonly createdBy: UserId;
|
|
23
|
+
readonly createdInstant: number;
|
|
24
|
+
readonly eventData: ActivityEventData;
|
|
25
|
+
readonly eventId: ActivityEventId;
|
|
26
|
+
readonly isRead: boolean;
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAgBA,cAAc,gBAAgB;AAC9B,cAAc,OAAO,iBAAiB;AACtC,cAAc,cAAc;AAE5B,YAAY,kBAAkB,SAAS;AAEvC,OAAO,cAAM;UACX,cAAc;UACd,SAAS;;AAGX,iBAAiB,wBAAwB,UAAU,QAAQ,OAAO;UACvD,aAAa,sBAAsB;UACnC,OAAO;UACP,WAAW,UAAU;;AAKhC,iBAAiB,yBAAyB;UAC/B,MAAM;UACN;UACA;;AAGX,YAAY,oBAAoB,0BAA0B;AAE1D,iBAAiB,cAAc;UACpB;UACA,WAAW;UACX;UACA,WAAW;UACX,SAAS;UACT","names":[],"sources":["../../../src/types/ActivityEvent.ts"],"version":3,"file":"ActivityEvent.d.ts"}
|
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
import type { Flavored } from "@palantir/pack.core";
|
|
2
|
+
import type { ActivityEvent } from "./ActivityEvent.js";
|
|
2
3
|
import type { DocumentMetadata } from "./DocumentMetadata.js";
|
|
3
4
|
import type { DocumentSchema, DocumentState } from "./DocumentSchema.js";
|
|
4
|
-
import type { Model } from "./Model.js";
|
|
5
|
+
import type { EditDescription, Model, ModelData } from "./Model.js";
|
|
6
|
+
import type { PresenceEvent } from "./PresenceEvent.js";
|
|
5
7
|
import type { RecordCollectionRef } from "./RecordCollectionRef.js";
|
|
6
8
|
import type { Unsubscribe } from "./Unsubscribe.js";
|
|
7
9
|
export type DocumentId = Flavored<"DocumentId">;
|
|
10
|
+
export interface PresenceSubscriptionOptions {
|
|
11
|
+
readonly ignoreSelfUpdates?: boolean;
|
|
12
|
+
}
|
|
8
13
|
export declare const DocumentRefBrand: unique symbol;
|
|
9
14
|
export interface DocumentRef<D extends DocumentSchema = DocumentSchema> {
|
|
10
15
|
readonly id: DocumentId;
|
|
11
16
|
readonly schema: D;
|
|
12
17
|
readonly [DocumentRefBrand]: typeof DocumentRefBrand;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
18
|
+
getDocSnapshot(): Promise<DocumentState<D>>;
|
|
19
|
+
getRecords<R extends Model>(model: R): RecordCollectionRef<R>;
|
|
20
|
+
onActivity(callback: (docRef: DocumentRef<D>, event: ActivityEvent) => void): Unsubscribe;
|
|
21
|
+
onMetadataChange(callback: (docRef: DocumentRef<D>, metadata: DocumentMetadata) => void): Unsubscribe;
|
|
22
|
+
onPresence(callback: (docRef: DocumentRef<D>, event: PresenceEvent) => void, options?: PresenceSubscriptionOptions): Unsubscribe;
|
|
23
|
+
onStateChange(callback: (docRef: DocumentRef<D>) => void): Unsubscribe;
|
|
24
|
+
updateCustomPresence<M extends Model = Model>(model: M, eventData: ModelData<M>): void;
|
|
25
|
+
withTransaction(fn: () => void, description?: EditDescription): void;
|
|
17
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAgBA,cAAc,gBAAgB;AAC9B,cAAc,wBAAwB;AACtC,cAAc,gBAAgB,qBAAqB;AACnD,cAAc,
|
|
1
|
+
{"mappings":"AAgBA,cAAc,gBAAgB;AAC9B,cAAc,qBAAqB;AACnC,cAAc,wBAAwB;AACtC,cAAc,gBAAgB,qBAAqB;AACnD,cAAc,iBAAiB,OAAO,iBAAiB;AACvD,cAAc,qBAAqB;AACnC,cAAc,2BAA2B;AACzC,cAAc,mBAAmB;AAEjC,YAAY,aAAa,SAAS;AAElC,iBAAiB,4BAA4B;UAClC;;AAGX,OAAO,cAAMA;AAEb,iBAAiB,YAAY,UAAU,iBAAiB,gBAAgB;UAC7D,IAAI;UACJ,QAAQ;WACP,0BAA0B;CAEpC,kBAAkB,QAAQ,cAAc;CACxC,WAAW,UAAU,OAAO,OAAO,IAAI,oBAAoB;CAC3D,WACE,WAAW,QAAQ,YAAY,IAAI,OAAO,yBACzC;CACH,iBACE,WAAW,QAAQ,YAAY,IAAI,UAAU,4BAC5C;CACH,WACE,WAAW,QAAQ,YAAY,IAAI,OAAO,wBAC1C,UAAU,8BACT;CACH,cACE,WAAW,QAAQ,YAAY,cAC9B;CACH,qBAAqB,UAAU,QAAQ,OACrC,OAAO,GACP,WAAW,UAAU;CAEvB,gBAAgB,gBAAgB,cAAc","names":["DocumentRefBrand: unique symbol"],"sources":["../../../src/types/DocumentRef.ts"],"version":3,"file":"DocumentRef.d.ts"}
|
|
@@ -13,6 +13,10 @@ export interface Model<
|
|
|
13
13
|
readonly zodSchema: Readonly<Z>;
|
|
14
14
|
}
|
|
15
15
|
export type ModelData<M extends Model> = M["__type"];
|
|
16
|
+
export interface EditDescription<M extends Model = Model> {
|
|
17
|
+
readonly data: ModelData<M>;
|
|
18
|
+
readonly model: M;
|
|
19
|
+
}
|
|
16
20
|
export declare const ExternalRefType: {
|
|
17
21
|
readonly DOC_REF: "docRef";
|
|
18
22
|
readonly MEDIA_REF: "mediaRef";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAgBA,cAAc,eAAe;AAC7B,cAAc,oBAAoB;;;;;;AAQlC,iBAAiB;CAAM;CAAa,UAAU,QAAQ,KAAK,QAAQ;UACzD,aAAa,cAAc,IACrC;UACW,QAAQ;UACR,WAAW,SAAS;;AAG/B,YAAY,UAAU,UAAU,SAAS,EAAE;AAE3C,OAAO,cAAM;UACX,SAAS;UACT,WAAW;UACX,YAAY;UACZ,UAAU;;AAGZ,YAAY,yBAAyB,6BAA6B;AAElE,iBAAiB,cAAc,aAAa;UACjC,wBAAwB,SAAS,aAAa,GAAG;UACjD","names":[],"sources":["../../../src/types/Model.ts"],"version":3,"file":"Model.d.ts"}
|
|
1
|
+
{"mappings":"AAgBA,cAAc,eAAe;AAC7B,cAAc,oBAAoB;;;;;;AAQlC,iBAAiB;CAAM;CAAa,UAAU,QAAQ,KAAK,QAAQ;UACzD,aAAa,cAAc,IACrC;UACW,QAAQ;UACR,WAAW,SAAS;;AAG/B,YAAY,UAAU,UAAU,SAAS,EAAE;AAE3C,iBAAiB,gBAAgB,UAAU,QAAQ,OAAO;UAC/C,MAAM,UAAU;UAChB,OAAO;;AAGlB,OAAO,cAAM;UACX,SAAS;UACT,WAAW;UACX,YAAY;UACZ,UAAU;;AAGZ,YAAY,yBAAyB,6BAA6B;AAElE,iBAAiB,cAAc,aAAa;UACjC,wBAAwB,SAAS,aAAa,GAAG;UACjD","names":[],"sources":["../../../src/types/Model.ts"],"version":3,"file":"Model.d.ts"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Model, ModelData } from "./Model.js";
|
|
2
|
+
import type { UserId } from "./UserRef.js";
|
|
3
|
+
export declare const PresenceEventDataType: {
|
|
4
|
+
readonly ARRIVED: "presenceArrived";
|
|
5
|
+
readonly DEPARTED: "presenceDeparted";
|
|
6
|
+
readonly CUSTOM_EVENT: "customEvent";
|
|
7
|
+
readonly UNKNOWN: "unknown";
|
|
8
|
+
};
|
|
9
|
+
export type PresenceEventDataType = typeof PresenceEventDataType[keyof typeof PresenceEventDataType];
|
|
10
|
+
export interface PresenceEventDataArrived {
|
|
11
|
+
readonly type: typeof PresenceEventDataType.ARRIVED;
|
|
12
|
+
}
|
|
13
|
+
export interface PresenceEventDataDeparted {
|
|
14
|
+
readonly type: typeof PresenceEventDataType.DEPARTED;
|
|
15
|
+
}
|
|
16
|
+
export interface PresenceEventDataCustom<M extends Model = Model> {
|
|
17
|
+
readonly type: typeof PresenceEventDataType.CUSTOM_EVENT;
|
|
18
|
+
readonly eventData: ModelData<M>;
|
|
19
|
+
readonly model: M;
|
|
20
|
+
}
|
|
21
|
+
export interface PresenceEventUnknown {
|
|
22
|
+
readonly type: "unknown";
|
|
23
|
+
readonly rawType: string;
|
|
24
|
+
readonly rawData: unknown;
|
|
25
|
+
}
|
|
26
|
+
export type PresenceEventData = PresenceEventDataArrived | PresenceEventDataDeparted | PresenceEventDataCustom | PresenceEventUnknown;
|
|
27
|
+
export interface PresenceEvent {
|
|
28
|
+
readonly userId: UserId;
|
|
29
|
+
readonly eventData: PresenceEventData;
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAgBA,cAAc,OAAO,iBAAiB;AACtC,cAAc,cAAc;AAE5B,OAAO,cAAM;UACX,SAAS;UACT,UAAU;UACV,cAAc;UACd,SAAS;;AAGX,YAAY,+BACH,mCAAmC;AAE5C,iBAAiB,yBAAyB;UAC/B,aAAa,sBAAsB;;AAG9C,iBAAiB,0BAA0B;UAChC,aAAa,sBAAsB;;AAG9C,iBAAiB,wBAAwB,UAAU,QAAQ,OAAO;UACvD,aAAa,sBAAsB;UACnC,WAAW,UAAU;UACrB,OAAO;;AAGlB,iBAAiB,qBAAqB;UAC3B,MAAM;UACN;UACA;;AAGX,YAAY,oBACR,2BACA,4BACA,0BACA;AAEJ,iBAAiB,cAAc;UACpB,QAAQ;UACR,WAAW","names":[],"sources":["../../../src/types/PresenceEvent.ts"],"version":3,"file":"PresenceEvent.d.ts"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@palantir/pack.document-schema.model-types",
|
|
3
|
-
"version": "0.1.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "Minimal types supporting generated PACK schemas",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@palantir/pack.core": "~0.1.0
|
|
31
|
+
"@palantir/pack.core": "~0.1.0"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"zod": "^4.1.7"
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"rimraf": "^6.0.1",
|
|
38
38
|
"tslib": "^2.8.1",
|
|
39
39
|
"typescript": "^5.9.2",
|
|
40
|
-
"@palantir/pack.monorepo.tsconfig": "~0.4.0
|
|
40
|
+
"@palantir/pack.monorepo.tsconfig": "~0.4.0"
|
|
41
41
|
},
|
|
42
42
|
"publishConfig": {
|
|
43
43
|
"access": "public"
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
"type": "module",
|
|
49
49
|
"scripts": {
|
|
50
50
|
"clean": "rimraf .turbo build dist lib test-output *.tgz tsconfig.tsbuildinfo",
|
|
51
|
-
"lint": "eslint ./src
|
|
52
|
-
"lint:fix": "eslint ./src --fix
|
|
51
|
+
"lint": "eslint ./src && dprint check --config $(find-up dprint.json) --allow-no-files",
|
|
52
|
+
"lint:fix": "eslint ./src --fix && dprint fmt --config $(find-up dprint.json) --allow-no-files",
|
|
53
53
|
"test": "vitest run --passWithNoTests -u",
|
|
54
54
|
"test:watch": "vitest --passWithNoTests",
|
|
55
55
|
"transpileBrowser": "monorepo-transpile -f esm -m bundle -t browser",
|
package/src/index.ts
CHANGED
|
@@ -14,6 +14,14 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
+
export { ActivityEventDataType } from "./types/ActivityEvent.js";
|
|
18
|
+
export type {
|
|
19
|
+
ActivityEvent,
|
|
20
|
+
ActivityEventData,
|
|
21
|
+
ActivityEventDataCustom,
|
|
22
|
+
ActivityEventDataUnknown,
|
|
23
|
+
ActivityEventId,
|
|
24
|
+
} from "./types/ActivityEvent.js";
|
|
17
25
|
export type {
|
|
18
26
|
DiscretionaryPrincipal,
|
|
19
27
|
DiscretionaryPrincipal_All,
|
|
@@ -22,7 +30,7 @@ export type {
|
|
|
22
30
|
DocumentMetadata,
|
|
23
31
|
} from "./types/DocumentMetadata.js";
|
|
24
32
|
export { DocumentRefBrand } from "./types/DocumentRef.js";
|
|
25
|
-
export type { DocumentId, DocumentRef } from "./types/DocumentRef.js";
|
|
33
|
+
export type { DocumentId, DocumentRef, PresenceSubscriptionOptions } from "./types/DocumentRef.js";
|
|
26
34
|
export type {
|
|
27
35
|
DocumentSchema,
|
|
28
36
|
DocumentSchemaMetadata,
|
|
@@ -33,9 +41,18 @@ export type { MediaId, MediaRef } from "./types/MediaRef.js";
|
|
|
33
41
|
export { getMetadata, Metadata } from "./types/Metadata.js";
|
|
34
42
|
export type { WithMetadata } from "./types/Metadata.js";
|
|
35
43
|
export { ExternalRefType } from "./types/Model.js";
|
|
36
|
-
export type { Model, ModelData, ModelMetadata } from "./types/Model.js";
|
|
44
|
+
export type { EditDescription, Model, ModelData, ModelMetadata } from "./types/Model.js";
|
|
37
45
|
export { ObjectRefBrand } from "./types/ObjectRef.js";
|
|
38
46
|
export type { ObjectId, ObjectRef } from "./types/ObjectRef.js";
|
|
47
|
+
export { PresenceEventDataType } from "./types/PresenceEvent.js";
|
|
48
|
+
export type {
|
|
49
|
+
PresenceEvent,
|
|
50
|
+
PresenceEventData,
|
|
51
|
+
PresenceEventDataArrived,
|
|
52
|
+
PresenceEventDataCustom,
|
|
53
|
+
PresenceEventDataDeparted,
|
|
54
|
+
PresenceEventUnknown,
|
|
55
|
+
} from "./types/PresenceEvent.js";
|
|
39
56
|
export { RecordCollectionRefBrand } from "./types/RecordCollectionRef.js";
|
|
40
57
|
export type { RecordCollectionRef } from "./types/RecordCollectionRef.js";
|
|
41
58
|
export { RecordRefBrand } from "./types/RecordRef.js";
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import type { Flavored } from "@palantir/pack.core";
|
|
18
|
+
import type { Model, ModelData } from "./Model.js";
|
|
19
|
+
import type { UserId } from "./UserRef.js";
|
|
20
|
+
|
|
21
|
+
export type ActivityEventId = Flavored<"pack:EventId">;
|
|
22
|
+
|
|
23
|
+
export const ActivityEventDataType = {
|
|
24
|
+
CUSTOM_EVENT: "customEvent",
|
|
25
|
+
UNKNOWN: "unknown",
|
|
26
|
+
} as const;
|
|
27
|
+
|
|
28
|
+
export interface ActivityEventDataCustom<M extends Model = Model> {
|
|
29
|
+
readonly type: typeof ActivityEventDataType.CUSTOM_EVENT;
|
|
30
|
+
readonly model: M;
|
|
31
|
+
readonly eventData: ModelData<M>;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// TODO: add standard document activity events (need to be added to api types)
|
|
35
|
+
|
|
36
|
+
export interface ActivityEventDataUnknown {
|
|
37
|
+
readonly type: "unknown";
|
|
38
|
+
readonly rawType: string;
|
|
39
|
+
readonly rawData: unknown;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export type ActivityEventData = ActivityEventDataCustom | ActivityEventDataUnknown;
|
|
43
|
+
|
|
44
|
+
export interface ActivityEvent {
|
|
45
|
+
readonly aggregationKey: string;
|
|
46
|
+
readonly createdBy: UserId;
|
|
47
|
+
readonly createdInstant: number;
|
|
48
|
+
readonly eventData: ActivityEventData;
|
|
49
|
+
readonly eventId: ActivityEventId;
|
|
50
|
+
readonly isRead: boolean;
|
|
51
|
+
}
|
package/src/types/DocumentRef.ts
CHANGED
|
@@ -15,14 +15,20 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import type { Flavored } from "@palantir/pack.core";
|
|
18
|
+
import type { ActivityEvent } from "./ActivityEvent.js";
|
|
18
19
|
import type { DocumentMetadata } from "./DocumentMetadata.js";
|
|
19
20
|
import type { DocumentSchema, DocumentState } from "./DocumentSchema.js";
|
|
20
|
-
import type { Model } from "./Model.js";
|
|
21
|
+
import type { EditDescription, Model, ModelData } from "./Model.js";
|
|
22
|
+
import type { PresenceEvent } from "./PresenceEvent.js";
|
|
21
23
|
import type { RecordCollectionRef } from "./RecordCollectionRef.js";
|
|
22
24
|
import type { Unsubscribe } from "./Unsubscribe.js";
|
|
23
25
|
|
|
24
26
|
export type DocumentId = Flavored<"DocumentId">;
|
|
25
27
|
|
|
28
|
+
export interface PresenceSubscriptionOptions {
|
|
29
|
+
readonly ignoreSelfUpdates?: boolean;
|
|
30
|
+
}
|
|
31
|
+
|
|
26
32
|
export const DocumentRefBrand: unique symbol = Symbol("pack:DocumentRef");
|
|
27
33
|
|
|
28
34
|
export interface DocumentRef<D extends DocumentSchema = DocumentSchema> {
|
|
@@ -30,12 +36,24 @@ export interface DocumentRef<D extends DocumentSchema = DocumentSchema> {
|
|
|
30
36
|
readonly schema: D;
|
|
31
37
|
readonly [DocumentRefBrand]: typeof DocumentRefBrand;
|
|
32
38
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
callback: (
|
|
37
|
-
)
|
|
38
|
-
|
|
39
|
+
getDocSnapshot(): Promise<DocumentState<D>>;
|
|
40
|
+
getRecords<R extends Model>(model: R): RecordCollectionRef<R>;
|
|
41
|
+
onActivity(
|
|
42
|
+
callback: (docRef: DocumentRef<D>, event: ActivityEvent) => void,
|
|
43
|
+
): Unsubscribe;
|
|
44
|
+
onMetadataChange(
|
|
45
|
+
callback: (docRef: DocumentRef<D>, metadata: DocumentMetadata) => void,
|
|
46
|
+
): Unsubscribe;
|
|
47
|
+
onPresence(
|
|
48
|
+
callback: (docRef: DocumentRef<D>, event: PresenceEvent) => void,
|
|
49
|
+
options?: PresenceSubscriptionOptions,
|
|
50
|
+
): Unsubscribe;
|
|
51
|
+
onStateChange(
|
|
39
52
|
callback: (docRef: DocumentRef<D>) => void,
|
|
40
|
-
)
|
|
53
|
+
): Unsubscribe;
|
|
54
|
+
updateCustomPresence<M extends Model = Model>(
|
|
55
|
+
model: M,
|
|
56
|
+
eventData: ModelData<M>,
|
|
57
|
+
): void;
|
|
58
|
+
withTransaction(fn: () => void, description?: EditDescription): void;
|
|
41
59
|
}
|
package/src/types/Model.ts
CHANGED
|
@@ -32,6 +32,11 @@ export interface Model<T = unknown, Z extends ZodType<T> = ZodType<T>>
|
|
|
32
32
|
|
|
33
33
|
export type ModelData<M extends Model> = M["__type"];
|
|
34
34
|
|
|
35
|
+
export interface EditDescription<M extends Model = Model> {
|
|
36
|
+
readonly data: ModelData<M>;
|
|
37
|
+
readonly model: M;
|
|
38
|
+
}
|
|
39
|
+
|
|
35
40
|
export const ExternalRefType = {
|
|
36
41
|
DOC_REF: "docRef",
|
|
37
42
|
MEDIA_REF: "mediaRef",
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import type { Model, ModelData } from "./Model.js";
|
|
18
|
+
import type { UserId } from "./UserRef.js";
|
|
19
|
+
|
|
20
|
+
export const PresenceEventDataType = {
|
|
21
|
+
ARRIVED: "presenceArrived",
|
|
22
|
+
DEPARTED: "presenceDeparted",
|
|
23
|
+
CUSTOM_EVENT: "customEvent",
|
|
24
|
+
UNKNOWN: "unknown",
|
|
25
|
+
} as const;
|
|
26
|
+
|
|
27
|
+
export type PresenceEventDataType =
|
|
28
|
+
typeof PresenceEventDataType[keyof typeof PresenceEventDataType];
|
|
29
|
+
|
|
30
|
+
export interface PresenceEventDataArrived {
|
|
31
|
+
readonly type: typeof PresenceEventDataType.ARRIVED;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface PresenceEventDataDeparted {
|
|
35
|
+
readonly type: typeof PresenceEventDataType.DEPARTED;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface PresenceEventDataCustom<M extends Model = Model> {
|
|
39
|
+
readonly type: typeof PresenceEventDataType.CUSTOM_EVENT;
|
|
40
|
+
readonly eventData: ModelData<M>;
|
|
41
|
+
readonly model: M;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface PresenceEventUnknown {
|
|
45
|
+
readonly type: "unknown";
|
|
46
|
+
readonly rawType: string;
|
|
47
|
+
readonly rawData: unknown;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export type PresenceEventData =
|
|
51
|
+
| PresenceEventDataArrived
|
|
52
|
+
| PresenceEventDataDeparted
|
|
53
|
+
| PresenceEventDataCustom
|
|
54
|
+
| PresenceEventUnknown;
|
|
55
|
+
|
|
56
|
+
export interface PresenceEvent {
|
|
57
|
+
readonly userId: UserId;
|
|
58
|
+
readonly eventData: PresenceEventData;
|
|
59
|
+
}
|