@palantir/pack.document-schema.type-gen 0.13.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -0
- package/build/esm/cli.js +0 -2
- package/build/esm/cli.js.map +1 -1
- package/build/esm/commands/ir/__tests__/resolveIrInput.test.js +88 -0
- package/build/esm/commands/ir/__tests__/resolveIrInput.test.js.map +1 -0
- package/build/esm/commands/ir/irDeployHandler.js +69 -17
- package/build/esm/commands/ir/irDeployHandler.js.map +1 -1
- package/build/esm/commands/ir/irGenAssetHandler.js +3 -34
- package/build/esm/commands/ir/irGenAssetHandler.js.map +1 -1
- package/build/esm/commands/{asset/assetUpdateSchemaHandler.js → ir/irUpdateSchemaHandler.js} +26 -31
- package/build/esm/commands/ir/irUpdateSchemaHandler.js.map +1 -0
- package/build/esm/commands/ir/registerIrCommands.js +3 -1
- package/build/esm/commands/ir/registerIrCommands.js.map +1 -1
- package/build/esm/commands/ir/resolveIrInput.js +50 -0
- package/build/esm/commands/ir/resolveIrInput.js.map +1 -0
- package/build/esm/commands/schema/registerSchemaCommands.js +1 -1
- package/build/esm/commands/schema/registerSchemaCommands.js.map +1 -1
- package/build/esm/commands/schema/schemaIrHandler.js +14 -4
- package/build/esm/commands/schema/schemaIrHandler.js.map +1 -1
- package/build/esm/commands/types.js.map +1 -1
- package/build/esm/commands/{asset → utils}/__tests__/buildPrefixRewriteFetch.test.js +1 -1
- package/build/esm/commands/utils/__tests__/buildPrefixRewriteFetch.test.js.map +1 -0
- package/build/esm/commands/utils/firstPartyPrefix.js +47 -0
- package/build/esm/commands/utils/firstPartyPrefix.js.map +1 -0
- package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/custom-discriminant.js +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/custom-discriminant.js.map +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/external-refs.js +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/external-refs.js.map +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/simple-record.js +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/simple-record.js.map +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/union-types.js +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateModelsFromIr/union-types.js.map +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/array-and-map-types.js +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/array-and-map-types.js.map +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/boolean-fields.js +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/boolean-fields.js.map +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/custom-discriminant.js +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/custom-discriminant.js.map +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/datetime-fields.js +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/datetime-fields.js.map +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/simple-records.js +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/simple-records.js.map +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/union-before-records.js +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/union-before-records.js.map +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/union-types.js +1 -1
- package/build/esm/utils/ir/__tests__/__snapshots__/generateZodSchemasFromIr/union-types.js.map +1 -1
- package/build/esm/utils/schema/__tests__/__snapshots__/generateDocumentTypeFromSchema/with-name-and-description.js +1 -1
- package/build/esm/utils/schema/__tests__/__snapshots__/generateDocumentTypeFromSchema/with-name-and-description.js.map +1 -1
- package/build/esm/utils/schema/__tests__/__snapshots__/generateVersionsFromSchema/single-version.js.map +1 -1
- package/build/esm/utils/schema/__tests__/__snapshots__/generateVersionsFromSchema/three-version-chain.js.map +1 -1
- package/build/esm/utils/schema/__tests__/__snapshots__/generateVersionsFromSchema/two-version.js.map +1 -1
- package/build/esm/utils/schema/__tests__/fixtures.js +11 -0
- package/build/esm/utils/schema/__tests__/fixtures.js.map +1 -1
- package/build/esm/utils/schema/__tests__/generateInternalFromSchema.test.js +6 -1
- package/build/esm/utils/schema/__tests__/generateInternalFromSchema.test.js.map +1 -1
- package/build/esm/utils/schema/__tests__/resolveSchemaChain.test.js +13 -0
- package/build/esm/utils/schema/__tests__/resolveSchemaChain.test.js.map +1 -1
- package/build/esm/utils/schema/generateInternalFromSchema.js +54 -33
- package/build/esm/utils/schema/generateInternalFromSchema.js.map +1 -1
- package/build/esm/utils/schema/generateModelMetadataFromSchema.js +12 -10
- package/build/esm/utils/schema/generateModelMetadataFromSchema.js.map +1 -1
- package/build/esm/utils/schema/generateScopeFromSchema.js +13 -1
- package/build/esm/utils/schema/generateScopeFromSchema.js.map +1 -1
- package/build/esm/utils/schema/resolveSchemaChain.js +37 -11
- package/build/esm/utils/schema/resolveSchemaChain.js.map +1 -1
- package/build/esm/utils/steps/__tests__/__snapshots__/types/arrayFields.js.map +1 -1
- package/build/esm/utils/steps/__tests__/__snapshots__/types/customDiscriminant.js +1 -1
- package/build/esm/utils/steps/__tests__/__snapshots__/types/customDiscriminant.js.map +1 -1
- package/build/esm/utils/steps/__tests__/__snapshots__/types/generateTypeScriptInterfaces.js +1 -1
- package/build/esm/utils/steps/__tests__/__snapshots__/types/generateTypeScriptInterfaces.js.map +1 -1
- package/build/esm/utils/steps/__tests__/__snapshots__/types/refTypes.js.map +1 -1
- package/build/esm/utils/steps/__tests__/__snapshots__/types/simpleRecord.js.map +1 -1
- package/build/esm/utils/steps/__tests__/__snapshots__/types/simpleSteps.js +1 -1
- package/build/esm/utils/steps/__tests__/__snapshots__/types/simpleSteps.js.map +1 -1
- package/build/types/cli.d.ts.map +1 -1
- package/build/types/commands/ir/__tests__/resolveIrInput.test.d.ts +2 -0
- package/build/types/commands/ir/__tests__/resolveIrInput.test.d.ts.map +1 -0
- package/build/types/commands/ir/irDeployHandler.d.ts +8 -2
- package/build/types/commands/ir/irDeployHandler.d.ts.map +1 -1
- package/build/types/commands/ir/irGenAssetHandler.d.ts.map +1 -1
- package/build/types/commands/ir/irUpdateSchemaHandler.d.ts +15 -0
- package/build/types/commands/ir/irUpdateSchemaHandler.d.ts.map +1 -0
- package/build/types/commands/ir/registerIrCommands.d.ts.map +1 -1
- package/build/types/commands/ir/resolveIrInput.d.ts +8 -0
- package/build/types/commands/ir/resolveIrInput.d.ts.map +1 -0
- package/build/types/commands/schema/registerSchemaCommands.d.ts.map +1 -1
- package/build/types/commands/schema/schemaIrHandler.d.ts +4 -3
- package/build/types/commands/schema/schemaIrHandler.d.ts.map +1 -1
- package/build/types/commands/types.d.ts +1 -3
- package/build/types/commands/types.d.ts.map +1 -1
- package/build/types/commands/utils/__tests__/buildPrefixRewriteFetch.test.d.ts.map +1 -0
- package/build/types/commands/{asset/assetDeployHandler.d.ts → utils/firstPartyPrefix.d.ts} +2 -11
- package/build/types/commands/utils/firstPartyPrefix.d.ts.map +1 -0
- package/build/types/utils/schema/__tests__/fixtures.d.ts +1 -0
- package/build/types/utils/schema/__tests__/fixtures.d.ts.map +1 -1
- package/build/types/utils/schema/generateInternalFromSchema.d.ts.map +1 -1
- package/build/types/utils/schema/generateModelMetadataFromSchema.d.ts.map +1 -1
- package/build/types/utils/schema/generateScopeFromSchema.d.ts.map +1 -1
- package/build/types/utils/schema/resolveSchemaChain.d.ts +13 -5
- package/build/types/utils/schema/resolveSchemaChain.d.ts.map +1 -1
- package/package.json +3 -3
- package/build/esm/commands/asset/__tests__/buildPrefixRewriteFetch.test.js.map +0 -1
- package/build/esm/commands/asset/assetDeployHandler.js +0 -95
- package/build/esm/commands/asset/assetDeployHandler.js.map +0 -1
- package/build/esm/commands/asset/assetUpdateSchemaHandler.js.map +0 -1
- package/build/esm/commands/asset/registerAssetCommands.js +0 -24
- package/build/esm/commands/asset/registerAssetCommands.js.map +0 -1
- package/build/types/commands/asset/__tests__/buildPrefixRewriteFetch.test.d.ts.map +0 -1
- package/build/types/commands/asset/assetDeployHandler.d.ts.map +0 -1
- package/build/types/commands/asset/assetUpdateSchemaHandler.d.ts +0 -12
- package/build/types/commands/asset/assetUpdateSchemaHandler.d.ts.map +0 -1
- package/build/types/commands/asset/registerAssetCommands.d.ts +0 -3
- package/build/types/commands/asset/registerAssetCommands.d.ts.map +0 -1
- /package/build/types/commands/{asset → utils}/__tests__/buildPrefixRewriteFetch.test.d.ts +0 -0
|
@@ -4,9 +4,7 @@ export interface DocumentTypeAsset {
|
|
|
4
4
|
readonly documentTypeName: string;
|
|
5
5
|
readonly documentStorageType: {
|
|
6
6
|
readonly type: "yjs";
|
|
7
|
-
readonly
|
|
8
|
-
readonly schema: DocumentTypeSchema;
|
|
9
|
-
};
|
|
7
|
+
readonly schema: DocumentTypeSchema;
|
|
10
8
|
};
|
|
11
9
|
readonly fileSystemType: FileSystemType;
|
|
12
10
|
readonly schemaVersion: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/commands/types.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAE7D,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG,SAAS,CAAC;AAErD,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,mBAAmB,EAAE;QAC5B,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;QACrB,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/commands/types.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAE7D,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG,SAAS,CAAC;AAErD,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,mBAAmB,EAAE;QAC5B,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;QACrB,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAC;KACrC,CAAC;IACF,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;IACxC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildPrefixRewriteFetch.test.d.ts","sourceRoot":"","sources":["../../../../../src/commands/utils/__tests__/buildPrefixRewriteFetch.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
readonly input: string;
|
|
3
|
-
readonly baseUrl: string;
|
|
4
|
-
readonly auth: string;
|
|
5
|
-
readonly ontologyRid: string;
|
|
6
|
-
readonly firstPartyPrefix?: string;
|
|
7
|
-
}
|
|
1
|
+
export declare const DEFAULT_API_PREFIX = "/api";
|
|
8
2
|
/**
|
|
9
3
|
* The set of API prefixes that `--first-party-prefix` is allowed to rewrite to.
|
|
10
4
|
* Only `/api/gotham` is supported today; expand this list as new gateways are added.
|
|
@@ -19,7 +13,4 @@ export declare const ALLOWED_FIRST_PARTY_PREFIXES: readonly ["/api/gotham"];
|
|
|
19
13
|
* Throws if `prefix` is not one of {@link ALLOWED_FIRST_PARTY_PREFIXES}.
|
|
20
14
|
*/
|
|
21
15
|
export declare function buildPrefixRewriteFetch(prefix: string): typeof globalThis.fetch;
|
|
22
|
-
|
|
23
|
-
export declare function assetDeployHandler(options: AssetDeployOptions): Promise<void>;
|
|
24
|
-
export {};
|
|
25
|
-
//# sourceMappingURL=assetDeployHandler.d.ts.map
|
|
16
|
+
//# sourceMappingURL=firstPartyPrefix.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"firstPartyPrefix.d.ts","sourceRoot":"","sources":["../../../../src/commands/utils/firstPartyPrefix.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,kBAAkB,SAAS,CAAC;AAEzC;;;GAGG;AACH,eAAO,MAAM,4BAA4B,0BAA2B,CAAC;AAErE;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,UAAU,CAAC,KAAK,CAoB/E"}
|
|
@@ -3,6 +3,7 @@ export declare const singleVersionSchema: SchemaDefinition;
|
|
|
3
3
|
/** Two-version schema with field removal (color removed, fillColor + strokeColor + opacity added) */
|
|
4
4
|
export declare const twoVersionFieldRemovalSchema: SchemaDefinition;
|
|
5
5
|
export declare const twoVersionAdditiveSchema: SchemaDefinition;
|
|
6
|
+
export declare const twoVersionRequiredAdditiveSchema: SchemaDefinition;
|
|
6
7
|
export declare const refFieldsSchema: SchemaDefinition;
|
|
7
8
|
export declare const unionTypesSchema: SchemaDefinition;
|
|
8
9
|
/** Schema with nested optionals: tests that optional inside array structures is preserved */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../../../../../src/utils/schema/__tests__/fixtures.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAiB,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAyB7E,eAAO,MAAM,mBAAmB,EAAE,gBAA4C,CAAC;AAE/E,qGAAqG;AACrG,eAAO,MAAM,4BAA4B,EAAE,gBAkB1C,CAAC;AAYF,eAAO,MAAM,wBAAwB,EAAE,gBAE7B,CAAC;
|
|
1
|
+
{"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../../../../../src/utils/schema/__tests__/fixtures.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAiB,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAyB7E,eAAO,MAAM,mBAAmB,EAAE,gBAA4C,CAAC;AAE/E,qGAAqG;AACrG,eAAO,MAAM,4BAA4B,EAAE,gBAkB1C,CAAC;AAYF,eAAO,MAAM,wBAAwB,EAAE,gBAE7B,CAAC;AAiBX,eAAO,MAAM,gCAAgC,EAAE,gBAEI,CAAC;AAapD,eAAO,MAAM,eAAe,EAAE,gBAY5B,CAAC;AAWH,eAAO,MAAM,gBAAgB,EAAE,gBAU7B,CAAC;AAEH,6FAA6F;AAC7F,eAAO,MAAM,qBAAqB,EAAE,gBASlC,CAAC;AAEH,wFAAwF;AACxF,eAAO,MAAM,6BAA6B,EAAE,gBA4B3C,CAAC;AAEF,0FAA0F;AAC1F,eAAO,MAAM,sBAAsB,EAAE,gBAOnC,CAAC;AAqBH,eAAO,MAAM,iBAAiB,EAAE,gBAU9B,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,6BAA6B,EAAE,gBAwBxC,CAAC;AAEL,wFAAwF;AACxF,eAAO,MAAM,uBAAuB,EAAE,gBAwClC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateInternalFromSchema.d.ts","sourceRoot":"","sources":["../../../../src/utils/schema/generateInternalFromSchema.ts"],"names":[],"mappings":"AA2BA,OAAO,EAEL,KAAK,eAAe,EAErB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,WAAW,mBAAmB;IAClC,iCAAiC;IACjC,aAAa,EAAE,MAAM,CAAC;IACtB,oCAAoC;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,kCAAkC;IAClC,cAAc,EAAE,MAAM,CAAC;IACvB,sCAAsC;IACtC,kBAAkB,EAAE,MAAM,CAAC;CAC5B;
|
|
1
|
+
{"version":3,"file":"generateInternalFromSchema.d.ts","sourceRoot":"","sources":["../../../../src/utils/schema/generateInternalFromSchema.ts"],"names":[],"mappings":"AA2BA,OAAO,EAEL,KAAK,eAAe,EAErB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,WAAW,mBAAmB;IAClC,iCAAiC;IACjC,aAAa,EAAE,MAAM,CAAC;IACtB,oCAAoC;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,kCAAkC;IAClC,cAAc,EAAE,MAAM,CAAC;IACvB,sCAAsC;IACtC,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAgdD;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,eAAe,GACxB,mBAAmB,CAarB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateModelMetadataFromSchema.d.ts","sourceRoot":"","sources":["../../../../src/utils/schema/generateModelMetadataFromSchema.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAW/D,MAAM,WAAW,mBAAmB;IAClC,sFAAsF;IACtF,UAAU,EAAE,MAAM,CAAC;CACpB;AAeD;;GAEG;AACH,wBAAgB,8BAA8B,CAC5C,QAAQ,EAAE,eAAe,EACzB,mBAAmB,CAAC,EAAE,MAAM,GAC3B,mBAAmB,
|
|
1
|
+
{"version":3,"file":"generateModelMetadataFromSchema.d.ts","sourceRoot":"","sources":["../../../../src/utils/schema/generateModelMetadataFromSchema.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAW/D,MAAM,WAAW,mBAAmB;IAClC,sFAAsF;IACtF,UAAU,EAAE,MAAM,CAAC;CACpB;AAeD;;GAEG;AACH,wBAAgB,8BAA8B,CAC5C,QAAQ,EAAE,eAAe,EACzB,mBAAmB,CAAC,EAAE,MAAM,GAC3B,mBAAmB,CAwLrB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateScopeFromSchema.d.ts","sourceRoot":"","sources":["../../../../src/utils/schema/generateScopeFromSchema.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAW/D;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,eAAe,EACzB,mBAAmB,CAAC,EAAE,MAAM,GAC3B,MAAM,
|
|
1
|
+
{"version":3,"file":"generateScopeFromSchema.d.ts","sourceRoot":"","sources":["../../../../src/utils/schema/generateScopeFromSchema.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAW/D;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,eAAe,EACzB,mBAAmB,CAAC,EAAE,MAAM,GAC3B,MAAM,CA8IR"}
|
|
@@ -42,7 +42,7 @@ export declare function resolveMinVersion(chain: VersionedIrEntry[], minSupporte
|
|
|
42
42
|
* defaults.
|
|
43
43
|
* Throws on empty chain or invalid minSupportedVersion.
|
|
44
44
|
*/
|
|
45
|
-
export declare function resolveSchemaChain(schema: SchemaDefinition, minSupportedVersion?: number, identity?: SchemaIdentity): ResolvedIrChain;
|
|
45
|
+
export declare function resolveSchemaChain(schema: SchemaDefinition, minSupportedVersion?: number, identity?: SchemaIdentity, maxVersion?: number): ResolvedIrChain;
|
|
46
46
|
/**
|
|
47
47
|
* Return a copy of the chain with deprecated fields removed from every version
|
|
48
48
|
* at or after the version in which they were deprecated.
|
|
@@ -56,9 +56,17 @@ export declare function resolveSchemaChain(schema: SchemaDefinition, minSupporte
|
|
|
56
56
|
*/
|
|
57
57
|
export declare function stripDeprecatedFieldsForSdk(chain: VersionedIrEntry[]): VersionedIrEntry[];
|
|
58
58
|
/**
|
|
59
|
-
* True if
|
|
60
|
-
* whether the generated SDK emits `DocumentModel` as a factory
|
|
61
|
-
* app to supply typed upgrade functions) or as a const
|
|
59
|
+
* True if the chain has any field that requires a runtime upgrade function.
|
|
60
|
+
* Drives whether the generated SDK emits `DocumentModel` as a factory
|
|
61
|
+
* (requires the app to supply typed upgrade functions) or as a const.
|
|
62
|
+
*
|
|
63
|
+
* Two cases trigger this:
|
|
64
|
+
* - A field declares `derivedFrom` with one or more source fields — the app
|
|
65
|
+
* must supply a forward function.
|
|
66
|
+
* - A required field is added in a version past v1 (no `derivedFrom`) — the
|
|
67
|
+
* app must supply a zero-arg thunk; `undefined` is not a legal value.
|
|
68
|
+
*
|
|
69
|
+
* Optional additive fields don't trigger it; the lens leaves them alone.
|
|
62
70
|
*/
|
|
63
|
-
export declare function
|
|
71
|
+
export declare function chainNeedsUpgradeFns(chain: VersionedIrEntry[]): boolean;
|
|
64
72
|
//# sourceMappingURL=resolveSchemaChain.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveSchemaChain.d.ts","sourceRoot":"","sources":["../../../../src/utils/schema/resolveSchemaChain.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,gBAAgB,EAAqB,MAAM,uBAAuB,CAAC;AACjF,OAAO,KAAK,EAEV,uBAAuB,EACxB,MAAM,yDAAyD,CAAC;AAKjE,0DAA0D;AAC1D,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;CACzC;AAED,qEAAqE;AACrE,MAAM,MAAM,2BAA2B,GAAG,MAAM,CAC9C,MAAM,EACN,MAAM,CAAC,MAAM,EAAE,wBAAwB,CAAC,CACzC,CAAC;AAEF,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,EAAE,EAAE,uBAAuB,CAAC;IAC5B,UAAU,CAAC,EAAE,2BAA2B,CAAC;CAC1C;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,gBAAgB,EAAE,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,cAAc;IAC7B,S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M,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,KAAK,EAAE,gBAAgB,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B;AAmGD;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,gBAAgB,EAAE,EACzB,mBAAmB,EAAE,MAAM,GAAG,SAAS,GACtC;IAAE,aAAa,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAkB/C;AAoBD;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,gBAAgB,EACxB,mBAAmB,CAAC,EAAE,MAAM,EAC5B,QAAQ,GAAE,cAAmB,EAC7B,UAAU,CAAC,EAAE,MAAM,GAClB,eAAe,CAIjB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,gBAAgB,EAAE,GAAG,gBAAgB,EAAE,CAgBzF;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,gBAAgB,EAAE,GAAG,OAAO,CAmBvE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@palantir/pack.document-schema.type-gen",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"description": "TypeScript type generation from document schema",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"tiny-invariant": "^1.3.3",
|
|
28
28
|
"yaml": "^2.8.2",
|
|
29
29
|
"zod": "^4.1.13",
|
|
30
|
-
"@palantir/pack.document-schema.model-types": "~0.
|
|
31
|
-
"@palantir/pack.schema": "0.
|
|
30
|
+
"@palantir/pack.document-schema.model-types": "~0.14.0",
|
|
31
|
+
"@palantir/pack.schema": "0.10.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@types/fs-extra": "^11.0.4",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buildPrefixRewriteFetch.test.js","names":["afterEach","beforeEach","describe","expect","it","vi","buildPrefixRewriteFetch","originalFetch","globalThis","fetch","fetchSpy","fn","Promise","resolve","Response","status","calledUrl","arg","mock","calls","url","wrapped","toBe","method","headers","body","JSON","stringify","hello","req","get","text","resolves","toThrow"],"sources":["buildPrefixRewriteFetch.test.ts"],"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\nimport { afterEach, beforeEach, describe, expect, it, vi } from \"vitest\";\nimport { buildPrefixRewriteFetch } from \"../assetDeployHandler.js\";\n\ndescribe(\"buildPrefixRewriteFetch\", () => {\n const originalFetch = globalThis.fetch;\n let fetchSpy: ReturnType<typeof vi.fn>;\n\n beforeEach(() => {\n fetchSpy = vi.fn(() => Promise.resolve(new Response(null, { status: 204 })));\n globalThis.fetch = fetchSpy as unknown as typeof globalThis.fetch;\n });\n\n afterEach(() => {\n globalThis.fetch = originalFetch;\n });\n\n function calledUrl(): string {\n const arg = fetchSpy.mock.calls[0]![0] as Request;\n return arg.url;\n }\n\n it(\"rewrites /api/foo to /api/gotham/foo\", async () => {\n const wrapped = buildPrefixRewriteFetch(\"/api/gotham\");\n await wrapped(\"https://stack.example.com/api/foo\");\n expect(calledUrl()).toBe(\"https://stack.example.com/api/gotham/foo\");\n });\n\n it(\"rewrites bare /api to /api/gotham\", async () => {\n const wrapped = buildPrefixRewriteFetch(\"/api/gotham\");\n await wrapped(\"https://stack.example.com/api\");\n expect(calledUrl()).toBe(\"https://stack.example.com/api/gotham\");\n });\n\n it(\"preserves query strings on rewritten requests\", async () => {\n const wrapped = buildPrefixRewriteFetch(\"/api/gotham\");\n await wrapped(\"https://stack.example.com/api/foo?x=1&y=2\");\n expect(calledUrl()).toBe(\"https://stack.example.com/api/gotham/foo?x=1&y=2\");\n });\n\n it(\"does not rewrite paths that only share the /api prefix string\", async () => {\n const wrapped = buildPrefixRewriteFetch(\"/api/gotham\");\n await wrapped(\"https://stack.example.com/apiother/foo\");\n expect(calledUrl()).toBe(\"https://stack.example.com/apiother/foo\");\n });\n\n it(\"does not rewrite non-/api paths\", async () => {\n const wrapped = buildPrefixRewriteFetch(\"/api/gotham\");\n await wrapped(\"https://stack.example.com/healthz\");\n expect(calledUrl()).toBe(\"https://stack.example.com/healthz\");\n });\n\n it(\"forwards method and headers from the original request\", async () => {\n const wrapped = buildPrefixRewriteFetch(\"/api/gotham\");\n await wrapped(\"https://stack.example.com/api/foo\", {\n method: \"POST\",\n headers: { \"x-custom\": \"value\" },\n body: JSON.stringify({ hello: \"world\" }),\n });\n const req = fetchSpy.mock.calls[0]![0] as Request;\n expect(req.method).toBe(\"POST\");\n expect(req.headers.get(\"x-custom\")).toBe(\"value\");\n await expect(req.text()).resolves.toBe(JSON.stringify({ hello: \"world\" }));\n });\n\n it(\"throws on an unsupported prefix\", () => {\n expect(() => buildPrefixRewriteFetch(\"/api/other\")).toThrow(\n /Unsupported first-party prefix/,\n );\n });\n\n it(\"throws on a prefix missing the leading slash\", () => {\n expect(() => buildPrefixRewriteFetch(\"api/gotham\")).toThrow(\n /Unsupported first-party prefix/,\n );\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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IAAI,CAAC,OAAO,CAAC;IACjD,MAAMnB,MAAM,CAAC0B,GAAG,CAACE,IAAI,CAAC,CAAC,CAAC,CAACC,QAAQ,CAACV,IAAI,CAACI,IAAI,CAACC,SAAS,CAAC;MAAEC,KAAK,EAAE;IAAQ,CAAC,CAAC,CAAC;EAC5E,CAAC,CAAC;EAEFxB,EAAE,CAAC,iCAAiC,EAAE,MAAM;IAC1CD,MAAM,CAAC,MAAMG,uBAAuB,CAAC,YAAY,CAAC,CAAC,CAAC2B,OAAO,CACzD,gCACF,CAAC;EACH,CAAC,CAAC;EAEF7B,EAAE,CAAC,8CAA8C,EAAE,MAAM;IACvDD,MAAM,CAAC,MAAMG,uBAAuB,CAAC,YAAY,CAAC,CAAC,CAAC2B,OAAO,CACzD,gCACF,CAAC;EACH,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,95 +0,0 @@
|
|
|
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 { createPlatformClient, PalantirApiError } from "@osdk/client";
|
|
18
|
-
import { DocumentTypes } from "@osdk/foundry.pack";
|
|
19
|
-
import { CommanderError } from "commander";
|
|
20
|
-
import { consola } from "consola";
|
|
21
|
-
import { readFileSync } from "fs";
|
|
22
|
-
import { resolve } from "path";
|
|
23
|
-
const DEFAULT_API_PREFIX = "/api";
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* The set of API prefixes that `--first-party-prefix` is allowed to rewrite to.
|
|
27
|
-
* Only `/api/gotham` is supported today; expand this list as new gateways are added.
|
|
28
|
-
*/
|
|
29
|
-
export const ALLOWED_FIRST_PARTY_PREFIXES = ["/api/gotham"];
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Builds a fetch wrapper that rewrites the OSDK client's `/api/...` requests
|
|
33
|
-
* to a different prefix (e.g. `/api/gotham`). Used for stacks where the
|
|
34
|
-
* endpoint is served behind a different gateway path instead
|
|
35
|
-
* of the default `/api` route.
|
|
36
|
-
*
|
|
37
|
-
* Throws if `prefix` is not one of {@link ALLOWED_FIRST_PARTY_PREFIXES}.
|
|
38
|
-
*/
|
|
39
|
-
export function buildPrefixRewriteFetch(prefix) {
|
|
40
|
-
if (!ALLOWED_FIRST_PARTY_PREFIXES.includes(prefix)) {
|
|
41
|
-
throw new Error(`Unsupported first-party prefix '${prefix}'. Allowed values: ${ALLOWED_FIRST_PARTY_PREFIXES.join(", ")}`);
|
|
42
|
-
}
|
|
43
|
-
return (input, init) => {
|
|
44
|
-
const req = new Request(input, init);
|
|
45
|
-
const url = new URL(req.url);
|
|
46
|
-
if (url.pathname !== DEFAULT_API_PREFIX && !url.pathname.startsWith(`${DEFAULT_API_PREFIX}/`)) {
|
|
47
|
-
return globalThis.fetch(req);
|
|
48
|
-
}
|
|
49
|
-
url.pathname = prefix + url.pathname.slice(DEFAULT_API_PREFIX.length);
|
|
50
|
-
return globalThis.fetch(new Request(url, req));
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/** Useful for manually deploying a document type during development to test schema changes. */
|
|
55
|
-
export async function assetDeployHandler(options) {
|
|
56
|
-
try {
|
|
57
|
-
const assetPath = resolve(options.input);
|
|
58
|
-
consola.info(`Reading asset file from: ${assetPath}`);
|
|
59
|
-
const assetContent = readFileSync(assetPath, "utf8");
|
|
60
|
-
const asset = JSON.parse(assetContent);
|
|
61
|
-
const fetchFn = options.firstPartyPrefix != null ? buildPrefixRewriteFetch(options.firstPartyPrefix) : undefined;
|
|
62
|
-
if (fetchFn != null) {
|
|
63
|
-
consola.info(`Rewriting OSDK '${DEFAULT_API_PREFIX}' -> '${options.firstPartyPrefix}'`);
|
|
64
|
-
}
|
|
65
|
-
const osdkClient = createPlatformClient(options.baseUrl, () => Promise.resolve(options.auth), undefined, fetchFn);
|
|
66
|
-
const request = {
|
|
67
|
-
requestBody: {
|
|
68
|
-
name: asset.documentTypeName,
|
|
69
|
-
ontologyRid: options.ontologyRid,
|
|
70
|
-
schema: asset.documentStorageType.yjs.schema,
|
|
71
|
-
fileSystemType: asset.fileSystemType,
|
|
72
|
-
version: asset.schemaVersion
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
consola.info("Creating first-party document type", request);
|
|
76
|
-
const result = await DocumentTypes.createFirstParty(osdkClient, request, {
|
|
77
|
-
preview: true
|
|
78
|
-
});
|
|
79
|
-
consola.success("Successfully created first-party document type", result);
|
|
80
|
-
} catch (error) {
|
|
81
|
-
if (error instanceof PalantirApiError) {
|
|
82
|
-
const {
|
|
83
|
-
message,
|
|
84
|
-
errorName,
|
|
85
|
-
errorCode
|
|
86
|
-
} = error;
|
|
87
|
-
const details = [errorName, errorCode].filter(Boolean).join(" ");
|
|
88
|
-
consola.error(`❌ Error during first-party deploy: ${message}${details ? ` [${details}]` : ""}`);
|
|
89
|
-
} else {
|
|
90
|
-
consola.error("❌ Error during first-party deploy:", error);
|
|
91
|
-
}
|
|
92
|
-
throw new CommanderError(1, "ERRASSETDEPLOY", "Error deploying document type from asset");
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
//# sourceMappingURL=assetDeployHandler.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"assetDeployHandler.js","names":["createPlatformClient","PalantirApiError","DocumentTypes","CommanderError","consola","readFileSync","resolve","DEFAULT_API_PREFIX","ALLOWED_FIRST_PARTY_PREFIXES","buildPrefixRewriteFetch","prefix","includes","Error","join","input","init","req","Request","url","URL","pathname","startsWith","globalThis","fetch","slice","length","assetDeployHandler","options","assetPath","info","assetContent","asset","JSON","parse","fetchFn","firstPartyPrefix","undefined","osdkClient","baseUrl","Promise","auth","request","requestBody","name","documentTypeName","ontologyRid","schema","documentStorageType","yjs","fileSystemType","version","schemaVersion","result","createFirstParty","preview","success","error","message","errorName","errorCode","details","filter","Boolean"],"sources":["assetDeployHandler.ts"],"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\nimport { createPlatformClient, PalantirApiError } from \"@osdk/client\";\nimport type { CreateFirstPartyDocumentTypeRequest } from \"@osdk/foundry.pack\";\nimport { DocumentTypes } from \"@osdk/foundry.pack\";\nimport { CommanderError } from \"commander\";\nimport { consola } from \"consola\";\nimport { readFileSync } from \"fs\";\nimport { resolve } from \"path\";\nimport type { DocumentTypeAsset } from \"../types.js\";\n\ninterface AssetDeployOptions {\n readonly input: string;\n readonly baseUrl: string;\n readonly auth: string;\n readonly ontologyRid: string;\n readonly firstPartyPrefix?: string;\n}\n\nconst DEFAULT_API_PREFIX = \"/api\";\n\n/**\n * The set of API prefixes that `--first-party-prefix` is allowed to rewrite to.\n * Only `/api/gotham` is supported today; expand this list as new gateways are added.\n */\nexport const ALLOWED_FIRST_PARTY_PREFIXES = [\"/api/gotham\"] as const;\n\n/**\n * Builds a fetch wrapper that rewrites the OSDK client's `/api/...` requests\n * to a different prefix (e.g. `/api/gotham`). Used for stacks where the\n * endpoint is served behind a different gateway path instead\n * of the default `/api` route.\n *\n * Throws if `prefix` is not one of {@link ALLOWED_FIRST_PARTY_PREFIXES}.\n */\nexport function buildPrefixRewriteFetch(prefix: string): typeof globalThis.fetch {\n if (!(ALLOWED_FIRST_PARTY_PREFIXES as readonly string[]).includes(prefix)) {\n throw new Error(\n `Unsupported first-party prefix '${prefix}'. Allowed values: ${\n ALLOWED_FIRST_PARTY_PREFIXES.join(\", \")\n }`,\n );\n }\n return (input, init) => {\n const req = new Request(input, init);\n const url = new URL(req.url);\n if (\n url.pathname !== DEFAULT_API_PREFIX\n && !url.pathname.startsWith(`${DEFAULT_API_PREFIX}/`)\n ) {\n return globalThis.fetch(req);\n }\n url.pathname = prefix + url.pathname.slice(DEFAULT_API_PREFIX.length);\n return globalThis.fetch(new Request(url, req));\n };\n}\n\n/** Useful for manually deploying a document type during development to test schema changes. */\nexport async function assetDeployHandler(options: AssetDeployOptions): Promise<void> {\n try {\n const assetPath = resolve(options.input);\n\n consola.info(`Reading asset file from: ${assetPath}`);\n\n const assetContent = readFileSync(assetPath, \"utf8\");\n const asset = JSON.parse(assetContent) as DocumentTypeAsset;\n\n const fetchFn = options.firstPartyPrefix != null\n ? buildPrefixRewriteFetch(options.firstPartyPrefix)\n : undefined;\n if (fetchFn != null) {\n consola.info(`Rewriting OSDK '${DEFAULT_API_PREFIX}' -> '${options.firstPartyPrefix}'`);\n }\n\n const osdkClient = createPlatformClient(\n options.baseUrl,\n () => Promise.resolve(options.auth),\n undefined,\n fetchFn,\n );\n\n const request: CreateFirstPartyDocumentTypeRequest = {\n requestBody: {\n name: asset.documentTypeName,\n ontologyRid: options.ontologyRid,\n schema: asset.documentStorageType.yjs.schema,\n fileSystemType: asset.fileSystemType,\n version: asset.schemaVersion,\n },\n };\n\n consola.info(\"Creating first-party document type\", request);\n\n const result = await DocumentTypes.createFirstParty(osdkClient, request, { preview: true });\n\n consola.success(\"Successfully created first-party document type\", result);\n } catch (error) {\n if (error instanceof PalantirApiError) {\n const { message, errorName, errorCode } = error;\n const details = [errorName, errorCode].filter(Boolean).join(\" \");\n consola.error(\n `❌ Error during first-party deploy: ${message}${details ? ` [${details}]` : \"\"}`,\n );\n } else {\n consola.error(\"❌ Error during first-party deploy:\", error);\n }\n throw new CommanderError(1, \"ERRASSETDEPLOY\", \"Error deploying document type from asset\");\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,oBAAoB,EAAEC,gBAAgB,QAAQ,cAAc;AAErE,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,cAAc,QAAQ,WAAW;AAC1C,SAASC,OAAO,QAAQ,SAAS;AACjC,SAASC,YAAY,QAAQ,IAAI;AACjC,SAASC,OAAO,QAAQ,MAAM;AAW9B,MAAMC,kBAAkB,GAAG,MAAM;;AAEjC;AACA;AACA;AACA;AACA,OAAO,MAAMC,4BAA4B,GAAG,CAAC,aAAa,CAAU;;AAEpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,uBAAuBA,CAACC,MAAc,EAA2B;EAC/E,IAAI,CAAEF,4BAA4B,CAAuBG,QAAQ,CAACD,MAAM,CAAC,EAAE;IACzE,MAAM,IAAIE,KAAK,CACb,mCAAmCF,MAAM,sBACvCF,4BAA4B,CAACK,IAAI,CAAC,IAAI,CAAC,EAE3C,CAAC;EACH;EACA,OAAO,CAACC,KAAK,EAAEC,IAAI,KAAK;IACtB,MAAMC,GAAG,GAAG,IAAIC,OAAO,CAACH,KAAK,EAAEC,IAAI,CAAC;IACpC,MAAMG,GAAG,GAAG,IAAIC,GAAG,CAACH,GAAG,CAACE,GAAG,CAAC;IAC5B,IACEA,GAAG,CAACE,QAAQ,KAAKb,kBAAkB,IAChC,CAACW,GAAG,CAACE,QAAQ,CAACC,UAAU,CAAC,GAAGd,kBAAkB,GAAG,CAAC,E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AK,CAACkB,cAAc;QACpCC,OAAO,EAAEnB,KAAK,CAACoB;MACjB;IACF,CAAC;IAED/C,OAAO,CAACyB,IAAI,CAAC,oCAAoC,EAAEY,OAAO,CAAC;IAE3D,MAAMW,MAAM,GAAG,MAAMlD,aAAa,CAACmD,gBAAgB,CAAChB,UAAU,EAAEI,OAAO,EAAE;MAAEa,OAAO,EAAE;IAAK,CAAC,CAAC;IAE3FlD,OAAO,CAACmD,OAAO,CAAC,gDAAgD,EAAEH,MAAM,CAAC;EAC3E,CAAC,CAAC,OAAOI,KAAK,EAAE;IACd,IAAIA,KAAK,YAAYvD,gBAAgB,EAAE;MACrC,MAAM;QAAEwD,OAAO;QAAEC,SAAS;QAAEC;MAAU,CAAC,GAAGH,KAAK;MAC/C,MAAMI,OAAO,GAAG,CAACF,SAAS,EAAEC,SAAS,CAAC,CAACE,MAAM,CAACC,OAAO,CAAC,CAACjD,IAAI,CAAC,GAAG,CAAC;MAChET,OAAO,CAACoD,KAAK,CACX,sCAAsCC,OAAO,GAAGG,OAAO,GAAG,KAAKA,OAAO,GAAG,GAAG,EAAE,EAChF,CAAC;IACH,CAAC,MAAM;MACLxD,OAAO,CAACoD,KAAK,CAAC,oCAAoC,EAAEA,KAAK,CAAC;IAC5D;IACA,MAAM,IAAIrD,cAAc,CAAC,CAAC,EAAE,gBAAgB,EAAE,0CAA0C,CAAC;EAC3F;AACF","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"assetUpdateSchemaHandler.js","names":["createPlatformClient","PalantirApiError","DocumentTypes","CommanderError","consola","readFileSync","resolve","buildPrefixRewriteFetch","DEFAULT_API_PREFIX","assetUpdateSchemaHandler","options","assetPath","input","info","assetContent","asset","JSON","parse","fetchFn","firstPartyPrefix","undefined","osdkClient","baseUrl","Promise","auth","request","documentTypeName","requestBody","ontologyRid","schema","documentStorageType","yjs","version","schemaVersion","forceOverwrite","warn","result","updateSchema","preview","type","success","error","violations","length","violation","fieldPath","violationType","message","errorName","errorCode","details","filter","Boolean","join"],"sources":["assetUpdateSchemaHandler.ts"],"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\nimport { createPlatformClient, PalantirApiError } from \"@osdk/client\";\nimport type { UpdateSchemaDocumentTypeRequest } from \"@osdk/foundry.pack\";\nimport { DocumentTypes } from \"@osdk/foundry.pack\";\nimport { CommanderError } from \"commander\";\nimport { consola } from \"consola\";\nimport { readFileSync } from \"fs\";\nimport { resolve } from \"path\";\nimport type { DocumentTypeAsset } from \"../types.js\";\nimport { buildPrefixRewriteFetch } from \"./assetDeployHandler.js\";\n\ninterface AssetUpdateSchemaOptions {\n readonly input: string;\n readonly baseUrl: string;\n readonly auth: string;\n readonly ontologyRid: string;\n readonly forceOverwrite?: boolean;\n readonly firstPartyPrefix?: string;\n}\n\nconst DEFAULT_API_PREFIX = \"/api\";\n\n/** Updates the schema of an existing document type using a generated asset JSON file. */\nexport async function assetUpdateSchemaHandler(\n options: AssetUpdateSchemaOptions,\n): Promise<void> {\n try {\n const assetPath = resolve(options.input);\n\n consola.info(`Reading asset file from: ${assetPath}`);\n\n const assetContent = readFileSync(assetPath, \"utf8\");\n const asset = JSON.parse(assetContent) as DocumentTypeAsset;\n\n const fetchFn = options.firstPartyPrefix != null\n ? buildPrefixRewriteFetch(options.firstPartyPrefix)\n : undefined;\n if (fetchFn != null) {\n consola.info(`Rewriting OSDK '${DEFAULT_API_PREFIX}' -> '${options.firstPartyPrefix}'`);\n }\n\n const osdkClient = createPlatformClient(\n options.baseUrl,\n () => Promise.resolve(options.auth),\n undefined,\n fetchFn,\n );\n\n const request: UpdateSchemaDocumentTypeRequest = {\n documentTypeName: asset.documentTypeName,\n requestBody: {\n ontologyRid: options.ontologyRid,\n schema: asset.documentStorageType.yjs.schema,\n version: asset.schemaVersion,\n ...(options.forceOverwrite ? { forceOverwrite: true } : {}),\n },\n };\n\n if (options.forceOverwrite) {\n consola.warn(\"--force-overwrite is set: backwards-compatibility validation will be skipped.\");\n }\n\n consola.info(\n `Updating schema for document type \"${asset.documentTypeName}\" -> version ${asset.schemaVersion}`,\n );\n\n const result = await DocumentTypes.updateSchema(osdkClient, request, { preview: true });\n\n if (result.type === \"success\") {\n consola.success(`Schema updated successfully (version ${result.version})`);\n return;\n }\n\n consola.error(`Schema validation failed with ${result.violations.length} violation(s):`);\n for (const violation of result.violations) {\n consola.error(` - ${violation.fieldPath}\\t${violation.violationType}\\t${violation.message}`);\n }\n consola.info(\"Hint: re-run with --force-overwrite to skip validation.\");\n throw new CommanderError(\n 1,\n \"ERRSCHEMAVALIDATION\",\n \"Schema validation failed during update\",\n );\n } catch (error) {\n if (error instanceof CommanderError) {\n throw error;\n }\n if (error instanceof PalantirApiError) {\n const { message, errorName, errorCode } = error;\n const details = [errorName, errorCode].filter(Boolean).join(\" \");\n consola.error(\n `❌ Error during schema update: ${message}${details ? ` [${details}]` : \"\"}`,\n );\n } else {\n consola.error(\"❌ Error during schema update:\", error);\n }\n throw new CommanderError(1, \"ERRASSETUPDATESCHEMA\", \"Error updating document type schema\");\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,oBAAoB,EAAEC,gBAAgB,QAAQ,cAAc;AAErE,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,cAAc,QAAQ,WAAW;AAC1C,SAASC,OAAO,QAAQ,SAAS;AACjC,SAASC,YAAY,QAAQ,IAAI;AACjC,SAASC,OAAO,QAAQ,MAAM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C,KAAK,CAAC,+BAA+B,EAAEA,KAAK,CAAC;IACvD;IACA,MAAM,IAAItC,cAAc,CAAC,CAAC,EAAE,sBAAsB,EAAE,qCAAqC,CAAC;EAC5F;AACF","ignoreList":[]}
|
|
@@ -1,24 +0,0 @@
|
|
|
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 { assetDeployHandler } from "./assetDeployHandler.js";
|
|
18
|
-
import { assetUpdateSchemaHandler } from "./assetUpdateSchemaHandler.js";
|
|
19
|
-
export function registerAssetCommands(program) {
|
|
20
|
-
const assetCmd = program.command("asset").description("Asset-based document type commands");
|
|
21
|
-
assetCmd.command("deploy").description("Deploy a document type to a Foundry stack using an asset JSON file").requiredOption("-i, --input <file>", "Path to asset JSON file (output of 'ir asset')").requiredOption("-b, --base-url <url>", "Base URL for Foundry API").requiredOption("-a, --auth <token>", "Authentication token for Foundry API").requiredOption("-o, --ontology-rid <rid>", "Target ontology RID").option("--first-party-prefix <path>", "Override the API prefix used for first-party deploy (e.g. /api/gotham). Defaults to /api.").action(assetDeployHandler);
|
|
22
|
-
assetCmd.command("update-schema").description("Update the schema of an existing document type using an asset JSON file").requiredOption("-i, --input <file>", "Path to asset JSON file (output of 'ir asset')").requiredOption("-b, --base-url <url>", "Base URL for Foundry API").requiredOption("-a, --auth <token>", "Authentication token for Foundry API").requiredOption("-o, --ontology-rid <rid>", "Target ontology RID").option("--force-overwrite", "Skip backwards-compatibility validation when updating the schema", false).option("--first-party-prefix <path>", "Override the API prefix used for first-party requests (e.g. /api/gotham). Defaults to /api.").action(assetUpdateSchemaHandler);
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=registerAssetCommands.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"registerAssetCommands.js","names":["assetDeployHandler","assetUpdateSchemaHandler","registerAssetCommands","program","assetCmd","command","description","requiredOption","option","action"],"sources":["registerAssetCommands.ts"],"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\nimport type { Command } from \"commander\";\nimport { assetDeployHandler } from \"./assetDeployHandler.js\";\nimport { assetUpdateSchemaHandler } from \"./assetUpdateSchemaHandler.js\";\n\nexport function registerAssetCommands(program: Command): void {\n const assetCmd = program\n .command(\"asset\")\n .description(\"Asset-based document type commands\");\n\n assetCmd\n .command(\"deploy\")\n .description(\"Deploy a document type to a Foundry stack using an asset JSON file\")\n .requiredOption(\"-i, --input <file>\", \"Path to asset JSON file (output of 'ir asset')\")\n .requiredOption(\"-b, --base-url <url>\", \"Base URL for Foundry API\")\n .requiredOption(\"-a, --auth <token>\", \"Authentication token for Foundry API\")\n .requiredOption(\"-o, --ontology-rid <rid>\", \"Target ontology RID\")\n .option(\n \"--first-party-prefix <path>\",\n \"Override the API prefix used for first-party deploy (e.g. /api/gotham). Defaults to /api.\",\n )\n .action(assetDeployHandler);\n\n assetCmd\n .command(\"update-schema\")\n .description(\n \"Update the schema of an existing document type using an asset JSON file\",\n )\n .requiredOption(\"-i, --input <file>\", \"Path to asset JSON file (output of 'ir asset')\")\n .requiredOption(\"-b, --base-url <url>\", \"Base URL for Foundry API\")\n .requiredOption(\"-a, --auth <token>\", \"Authentication token for Foundry API\")\n .requiredOption(\"-o, --ontology-rid <rid>\", \"Target ontology RID\")\n .option(\n \"--force-overwrite\",\n \"Skip backwards-compatibility validation when updating the schema\",\n false,\n )\n .option(\n \"--first-party-prefix <path>\",\n \"Override the API prefix used for first-party requests (e.g. /api/gotham). Defaults to /api.\",\n )\n .action(assetUpdateSchemaHandler);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,kBAAkB,QAAQ,yBAAyB;AAC5D,SAASC,wBAAwB,QAAQ,+BAA+B;AAExE,OAAO,SAASC,qBAAqBA,CAACC,OAAgB,EAAQ;EAC5D,MAAMC,QAAQ,GAAGD,OAAO,CACrBE,OAAO,CAAC,OAAO,CAAC,CAChBC,WAAW,CAAC,oCAAoC,CAAC;EAEpDF,QAAQ,CACLC,OAAO,CAAC,QAAQ,CAAC,CACjBC,WAAW,CAAC,oEAAoE,CAAC,CACjFC,cAAc,CAAC,oBAAoB,EAAE,gDAAgD,CAAC,CACtFA,cAAc,CAAC,sBAAsB,EAAE,0BAA0B,CAAC,CAClEA,cAAc,CAAC,oBAAoB,EAAE,sCAAsC,CAAC,CAC5EA,cAAc,CAAC,0BAA0B,EAAE,qBAAqB,CAAC,CACjEC,MAAM,CACL,6BAA6B,EAC7B,2FACF,CAAC,CACAC,MAAM,CAACT,kBAAkB,CAAC;EAE7BI,QAAQ,CACLC,OAAO,CAAC,eAAe,CAAC,CACxBC,WAAW,CACV,yEACF,CAAC,CACAC,cAAc,CAAC,oBAAoB,EAAE,gDAAgD,CAAC,CACtFA,cAAc,CAAC,sBAAsB,EAAE,0BAA0B,CAAC,CAClEA,cAAc,CAAC,oBAAoB,EAAE,sCAAsC,CAAC,CAC5EA,cAAc,CAAC,0BAA0B,EAAE,qBAAqB,CAAC,CACjEC,MAAM,CACL,mBAAmB,EACnB,kEAAkE,EAClE,KACF,CAAC,CACAA,MAAM,CACL,6BAA6B,EAC7B,6FACF,CAAC,CACAC,MAAM,CAACR,wBAAwB,CAAC;AACrC","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buildPrefixRewriteFetch.test.d.ts","sourceRoot":"","sources":["../../../../../src/commands/asset/__tests__/buildPrefixRewriteFetch.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"assetDeployHandler.d.ts","sourceRoot":"","sources":["../../../../src/commands/asset/assetDeployHandler.ts"],"names":[],"mappings":"AAyBA,UAAU,kBAAkB;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;CACpC;AAID;;;GAGG;AACH,eAAO,MAAM,4BAA4B,0BAA2B,CAAC;AAErE;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,UAAU,CAAC,KAAK,CAoB/E;AAED,+FAA+F;AAC/F,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAkDnF"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
interface AssetUpdateSchemaOptions {
|
|
2
|
-
readonly input: string;
|
|
3
|
-
readonly baseUrl: string;
|
|
4
|
-
readonly auth: string;
|
|
5
|
-
readonly ontologyRid: string;
|
|
6
|
-
readonly forceOverwrite?: boolean;
|
|
7
|
-
readonly firstPartyPrefix?: string;
|
|
8
|
-
}
|
|
9
|
-
/** Updates the schema of an existing document type using a generated asset JSON file. */
|
|
10
|
-
export declare function assetUpdateSchemaHandler(options: AssetUpdateSchemaOptions): Promise<void>;
|
|
11
|
-
export {};
|
|
12
|
-
//# sourceMappingURL=assetUpdateSchemaHandler.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"assetUpdateSchemaHandler.d.ts","sourceRoot":"","sources":["../../../../src/commands/asset/assetUpdateSchemaHandler.ts"],"names":[],"mappings":"AA0BA,UAAU,wBAAwB;IAChC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;IAClC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;CACpC;AAID,yFAAyF;AACzF,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,IAAI,CAAC,CAyEf"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"registerAssetCommands.d.ts","sourceRoot":"","sources":["../../../../src/commands/asset/registerAssetCommands.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIzC,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAqC5D"}
|
|
File without changes
|